Video picture prediction method and apparatus

ABSTRACT

This application provides a video picture prediction method and apparatus, to resolve a problem in a conventional technology that a length of a coded video sequence is increased. The first type of identifier may be added to a bitstream. The first type of identifier is used to indicate whether an affine motion model-based inter prediction mode is enabled for a video picture. For a video picture or a picture block included in the slice for which the affine motion model does not need to be used, a parameter, related to the affine motion model, of the picture block may not need to be transmitted. On a decoder side, during decoding of the picture block, the parameter related to the affine motion model does not need to be parsed. This can reduce load of a decoder, increase a processing speed, and decrease a processing time.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.17/858,567, filed on Jul. 6, 2022, which is a continuation of U.S.patent application Ser. No. 17/185,039, filed on Feb. 25, 2021, now U.S.Pat. No. 11,425,410, which is a continuation of InternationalApplication No. PCT/CN2019/083100, filed on Apr. 17, 2019, which claimspriority to Chinese Patent Application No. 201810983026.0, filed on Aug.27, 2018. All of the afore-mentioned patent applications are herebyincorporated by reference in their entireties.

TECHNICAL FIELD

This application relates to the field of picture encoding and decodingtechnologies, and in particular, to a video picture prediction methodand apparatus.

BACKGROUND

With development of information technologies, video services such ashigh definition television, web conferencing, IPTV, and 3D televisiondevelop rapidly. Thanks to advantages such as intuitiveness and highefficiency, video signals become a main manner of obtaining informationin people's daily life. The video signals include a large amount ofdata, and therefore occupy a large amount of transmission bandwidth andstorage space. To effectively transmit and store the video signals,compression encoding needs to be performed on the video signals. A videocompression technology has increasingly become an indispensable keytechnology in the field of video application.

A basic principle of video coding compression is to eliminate redundancyas much as possible based on a correlation between a space domain, atime domain, and a codeword. Currently, a prevalent method is to use apicture-block-based hybrid video coding framework to implement videocoding compression by performing steps such as prediction (includingintra prediction and inter prediction), transform, quantization, andentropy coding.

In various video encoding/decoding solutions, motion estimation/motioncompensation in inter prediction is a key technology that affectsencoding/decoding performance. In existing inter prediction,sub-block-based motion compensation prediction using a non-translationalmotion model (for example, an affine motion model) is added based onblock-based motion compensation (motion compensation, MC) predictionusing a translational motion model. Regardless of whether thenon-translational motion model is used, a related parameter about theaffine motion model needs to be added to a coded video sequence. As aresult, a length of the coded video sequence is increased.

SUMMARY

This application provides a video picture prediction method andapparatus, to resolve a problem in a conventional technology that alength of a coded video sequence is increased.

According to a first aspect, an embodiment of this application providesa video picture prediction method, including: parsing a bitstream toobtain a first identifier; when the first identifier indicates that acandidate motion model for inter prediction of a picture block in avideo picture including a to-be-processed block includes an affinemotion model, and the to-be-processed block meets a preset condition forinter prediction using the affine motion model, parsing the bitstream toobtain a second identifier; and determining, based on the secondidentifier, a prediction mode for inter prediction of theto-be-processed block, where the prediction mode includes an affinemotion model-based merge mode, an affine motion model-based AMVP mode,and a non-affine motion model-based prediction mode.

In the foregoing solution, for example, some video pictures may havesome affine features, while some video pictures may have no affinefeatures. In this case, an identifier may be added to a bitstream toindicate whether an affine motion model-based inter prediction mode isenabled for the video picture. If the affine motion model-based interprediction mode is not enabled for the video picture, a parameter,related to the affine motion model, of a picture block of the videopicture may not need to be transmitted. On a decoder side, duringdecoding of the picture block of the video picture, the parameterrelated to the affine motion model does not need to be parsed. This canreduce load of a decoder, increase a processing speed, and decrease aprocessing time.

For example, terms such as “first” and “second” are merely used fordistinction and description, and shall not be understood as anindication or implication of relative importance or an indication orimplication of an order. In addition, for a parameter such as anidentifier, different names may be used for description of same contentin various aspects and specific embodiments. For example, the firstidentifier in the first aspect is referred to as a fifth identifier inthe second aspect. In a specific embodiment, the first identifier in thefirst aspect is referred to as an identifier 1, and the secondidentifier in the first aspect is referred to as an identifier 12.

In a possible design of the first aspect, the parsing a bitstream toobtain a first identifier may be implemented in the following manner:parsing a sequence parameter set of the bitstream to obtain the firstidentifier. When the first identifier is configured in the sequenceparameter set, and the first identifier indicates that the affine motionmodel-based inter prediction mode is not enabled for the video picture,each picture-block-level syntax of the video picture does not include asyntax element related to the affine motion model. On the decoder side,during decoding of the picture block of the video picture, the parameterrelated to the affine motion model does not need to be parsed. This canreduce load of a decoder, increase a processing speed, and decrease aprocessing time.

In a possible design of the first aspect, when the first identifierindicates that the candidate motion model for inter prediction of thepicture block of the video picture including the to-be-processed blockincludes the affine motion model, the method further includes: parsingthe bitstream to obtain a third identifier. When the third identifier isa first value, the affine motion model includes only a 4-parameteraffine model; or when the third identifier is a second value, the affinemotion model includes a 4-parameter affine model and a 6-parameteraffine model. The first value is different from the second value.

In the foregoing design, the third identifier indicating whether theaffine motion model including a 6-parameter affine model is enabled forthe video picture may be further configured in the bitstream. When thethird identifier indicates that the 6-parameter affine model is notenabled for the video picture, a parameter related to the 6-parameteraffine model does not need to be parsed for the picture block of thevideo picture, and the parameter related to the 6-parameter affine modeldoes not need to be transmitted, in the bitstream, for each pictureblock of the video picture, either. This can reduce a length of a codedvideo sequence, reduce load of a decoder, increase a processing speed,and decrease a processing time.

In a specific embodiment, the third identifier in the first aspect isreferred to as an identifier 13.

In a possible design of the first aspect, the method further includes:when the second identifier indicates that affine motion model-basedmerge mode is used for inter prediction of the to-be-processed block,and the third identifier is the second value, constructing a firstcandidate motion vector list, where the first candidate motion vectorlist includes a first element, and the first element includes motioninformation of three control points for constructing the 6-parameteraffine motion model; or when the second identifier indicates that affinemotion model-based merge mode is used for inter prediction of theto-be-processed block, and the third identifier is the first value,constructing a second candidate motion vector list, where the secondcandidate motion vector list includes a second element, and the secondelement includes only motion information of two control points forconstructing the 4-parameter affine motion model.

In the foregoing design, the third identifier and the second identifierare used to indicate construction of the candidate motion vector lists.

In a possible design of the first aspect, when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, the first candidate motion vector list further includesthe second element.

In a possible design of the first aspect, the method further includes:when the second identifier indicates that the affine motion model-basedAMVP mode is used for inter prediction of the to-be-processed block, andthe third identifier is the second value, parsing the bitstream toobtain a fourth identifier. When the fourth identifier is a third value,the affine motion model is the 6-parameter affine motion model, or whenthe fourth identifier is a fourth value, the affine motion model is the4-parameter affine motion model. The third value is different from thefourth value.

In a specific embodiment, the fourth identifier is referred to as anidentifier 14.

In a possible design of the first aspect, the parsing the bitstream toobtain a third identifier includes: parsing the sequence parameter setof the bitstream to obtain the third identifier.

In a possible design of the first aspect, the preset condition includesthat a width of the to-be-processed block is greater than or equal to afirst preset threshold, and a height of the to-be-processed block isgreater than or equal to a second preset threshold.

In a possible design of the first aspect, the first preset threshold isequal to the second preset threshold.

According to a second aspect, an embodiment of this application providesa video picture prediction method, including: parsing a bitstream toobtain a first identifier; when the first identifier indicates that acandidate motion model for inter prediction of a picture block of aslice including a to-be-processed block includes an affine motion model,and the to-be-processed block meets a preset condition for interprediction using the affine motion model, parsing the bitstream toobtain a second identifier; and determining, based on the secondidentifier, a prediction mode for inter prediction of theto-be-processed block, where the prediction mode includes an affinemotion model-based merge mode, an affine motion model-based AMVP mode,and a non-affine motion model-based prediction mode.

In the foregoing solution, for example, some slices of a video picturemay have some affine features, while some slices of the video picturemay have no affine features. In this case, an identifier may be added tothe bitstream to indicate whether an affine motion model-based interprediction mode is enabled for a slice of the video picture. If theaffine motion model-based inter prediction mode is not enabled for theslice, a parameter, related to the affine motion model, of a pictureblock included in the slice may not need to be transmitted. On a decoderside, during decoding of the picture block in the slice, the parameterrelated to the affine motion model does not need to be parsed. This canreduce load of a decoder, increase a processing speed, and decrease aprocessing time.

It should be noted that the first identifier in the second aspect isreferred to as an identifier 2 in a specific embodiment, and the secondidentifier in the second aspect is referred to as an identifier 22 in aspecific embodiment.

In a possible design of the second aspect, the parsing a bitstream toobtain a first identifier includes: parsing a slice header of the slicein the bitstream to obtain the first identifier.

When the first identifier is configured in the slice header of theslice, and the first identifier indicates that the affine motionmodel-based inter prediction mode is not enabled for the slice, eachpicture-block-level syntax of the slice does not include a syntaxelement related to the affine motion model. On the decoder side, duringdecoding of the picture block in the slice, the parameter related to theaffine motion model does not need to be parsed. This can reduce load ofa decoder, increase a processing speed, and decrease a processing time.

In a possible design of the second aspect, when the first identifierindicates that the candidate motion model for inter prediction of thepicture block in the slice including the to-be-processed block includesthe affine motion model, the method further includes: parsing thebitstream to obtain a third identifier. When the third identifier is afirst value, the affine motion model includes only a 4-parameter affinemodel; or when the third identifier is a second value, the affine motionmodel includes a 4-parameter affine model and a 6-parameter affinemodel. The first value is different from the second value.

It should be noted that the third identifier in the second aspect isreferred to as an identifier 23 in a specific embodiment.

In a possible design of the second aspect, the method further includes:when the second identifier indicates that affine motion model-basedmerge mode is used for inter prediction of the to-be-processed block,and the third identifier is the second value, constructing a firstcandidate motion vector list, where the first candidate motion vectorlist includes a first element, and the first element includes motioninformation of three control points for constructing the 6-parameteraffine motion model; or when the second identifier indicates that affinemotion model-based merge mode is used for inter prediction of theto-be-processed block, and the third identifier is the first value,constructing a second candidate motion vector list, where the secondcandidate motion vector list includes a second element, and the secondelement includes only motion information of two control points forconstructing the 4-parameter affine motion model.

In a possible design of the second aspect, when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, the first candidate motion vector list further includesthe second element.

In a possible design of the second aspect, the method further includes:when the second identifier indicates that the affine motion model-basedAMVP mode is used for inter prediction of the to-be-processed block, andthe third identifier is the second value, parsing the bitstream toobtain a fourth identifier.

When the fourth identifier is a third value, the affine motion model isthe 6-parameter affine motion model, or when the fourth identifier is afourth value, the affine motion model is the 4-parameter affine motionmodel. The third value is different from the fourth value.

It should be noted that, in this application, the fourth identifier isreferred to as an identifier 24 in a specific embodiment.

In the foregoing design, the third identifier indicating whether theaffine motion model used for the slice may include the 6-parameteraffine motion model may be further configured in the bitstream. When thethird identifier indicates that the 6-parameter affine model is notenabled for the slice, a parameter related to the 6-parameter affinemodel does not need to be parsed for the picture block included in theslice, and the parameter related to the 6-parameter affine model doesnot need to be transmitted, in the bitstream, for each picture blockincluded in the slice, either. This can reduce a length of a coded videosequence, reduce load of a decoder, increase a processing speed, anddecrease a processing time.

In a possible design of the second aspect, the parsing the bitstream toobtain a third identifier includes: parsing the slice header of theslice in the bitstream to obtain the third identifier.

In a possible design of the second aspect, before the parsing abitstream to obtain a first identifier, the method further includes:parsing the bitstream to obtain a fifth identifier. When the fifthidentifier is a fifth value, a candidate motion model for interprediction of a picture block in a video picture including theto-be-processed block includes the affine motion model, or when thefifth identifier is a sixth value, a candidate motion model for interprediction of a picture block in a video picture including theto-be-processed block includes only the non-affine motion model. Thefifth value is different from the sixth value.

The fifth identifier is referred to as an identifier 1 in a specificembodiment.

Some video pictures have no affine features, while not all slices ofsome video pictures have affine features. In this case, two identifiersmay be added to the bitstream. A first type of identifier (which isreferred to as the fifth identifier in the second aspect) is used toindicate whether the affine motion model-based inter prediction mode isenabled for the video picture, and a second type of identifier (which isreferred to as the first identifier in the second aspect) is used toindicate whether the affine motion model-based inter prediction mode isenabled for the slice in the video picture. For a video picture or apicture block included in the slice for which the affine motion modeldoes not need to be used, a parameter, related to the affine motionmodel, of the picture block may not need to be transmitted. On thedecoder side, during decoding of the picture block, the parameterrelated to the affine motion model does not need to be parsed. This canreduce load of a decoder, increase a processing speed, and decrease aprocessing time.

In a possible design of the second aspect, the parsing the bitstream toobtain a fifth identifier includes: parsing a sequence parameter set ofthe bitstream to obtain the fifth identifier.

In a possible design of the second aspect, after the parsing thebitstream to obtain a fifth identifier, and before the parsing abitstream to obtain a first identifier, the method further includes:parsing the bitstream to obtain a sixth identifier. The sixth identifieris used to determine that the bitstream includes the third identifier.

It should be noted that the sixth identifier in the second aspect isreferred to as an identifier 13 in a specific embodiment.

In a possible design of the second aspect, the parsing the bitstream toobtain a sixth identifier includes: parsing the sequence parameter setof the bitstream to obtain the sixth identifier.

In a possible design of the second aspect, the preset condition includesthat a width of the to-be-processed block is greater than or equal to afirst preset threshold, and a height of the to-be-processed block isgreater than or equal to a second preset threshold.

In a possible design of the second aspect, the first preset threshold isequal to the second preset threshold.

Based on a same inventive concept as the first aspect, according to athird aspect, an embodiment of this application provides a video pictureprediction apparatus, including:

-   -   a parsing unit, configured to: parse a bitstream to obtain a        first identifier; and when the first identifier indicates that a        candidate motion model for inter prediction of a picture block        in a video picture including a to-be-processed block includes an        affine motion model, and the to-be-processed block meets a        preset condition for inter prediction using the affine motion        model, parse the bitstream to obtain a second identifier.

The parsing unit is further configured to determine, based on the secondidentifier, a prediction mode for inter prediction of theto-be-processed block. The prediction mode includes an affine motionmodel-based merge mode, an affine motion model-based AMVP mode, and anon-affine motion model-based prediction mode.

In a possible design of the third aspect, when parsing the bitstream toobtain the first identifier, the parsing unit is specifically configuredto parse a sequence parameter set of the bitstream to obtain the firstidentifier.

In a possible design of the third aspect, when the first identifierindicates that the candidate motion model for inter prediction of thepicture block in the video picture including the to-be-processed blockincludes the affine motion model, the parsing unit is further configuredto parse the bitstream to obtain a third identifier. When the thirdidentifier is a first value, the affine motion model includes only a4-parameter affine model; or when the third identifier is a secondvalue, the affine motion model includes a 4-parameter affine model and a6-parameter affine model. The first value is different from the secondvalue.

In a possible design of the third aspect, the apparatus furtherincludes: a construction unit, configured to: when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, construct a first candidate motion vector list, where thefirst candidate motion vector list includes a first element, and thefirst element includes motion information of three control points forconstructing the 6-parameter affine motion model; or

-   -   when the second identifier indicates that affine motion        model-based merge mode is used for inter prediction of the        to-be-processed block, and the third identifier is the first        value, construct a second candidate motion vector list, where        the second candidate motion vector list includes a second        element, and the second element includes only motion information        of two control points for constructing the 4-parameter affine        motion model.

In a possible design of the third aspect, when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, the first candidate motion vector list further includesthe second element.

In a possible design of the third aspect, the parsing unit is furtherconfigured to:

-   -   when the second identifier indicates that the affine motion        model-based AMVP mode is used for inter prediction of the        to-be-processed block, and the third identifier is the second        value, parse the bitstream to obtain a fourth identifier.

When the fourth identifier is a third value, the affine motion model isthe 6-parameter affine motion model, or when the fourth identifier is afourth value, the affine motion model is the 4-parameter affine motionmodel. The third value is different from the fourth value.

In a possible design of the third aspect, when parsing the bitstream toobtain the third identifier, the parsing unit is specifically configuredto parse the sequence parameter set of the bitstream to obtain the thirdidentifier.

In a possible design of the third aspect, the preset condition includesthat a width of the to-be-processed block is greater than or equal to afirst preset threshold, and a height of the to-be-processed block isgreater than or equal to a second preset threshold.

In a possible design of the third aspect, the first preset threshold isequal to the second preset threshold.

Based on a same inventive concept as the second aspect, according to afourth aspect, an embodiment of this application provides a videopicture prediction apparatus, including: a parsing unit, configured toparse a bitstream to obtain a first identifier. The parsing unit isfurther configured to: when the first identifier indicates that acandidate motion model for inter prediction of a picture block in aslice including a to-be-processed block includes an affine motion model,and the to-be-processed block meets a preset condition for interprediction using the affine motion model, parse the bitstream to obtaina second identifier; and determine, based on the second identifier, aprediction mode for inter prediction of the to-be-processed block. Theprediction mode includes an affine motion model-based merge mode, anaffine motion model-based AMVP mode, and a non-affine motion model-basedprediction mode.

In a possible design of the fourth aspect, when parsing the bitstream toobtain the first identifier, the parsing unit is specifically configuredto parse a slice header of the slice in the bitstream to obtain thefirst identifier.

In a possible design of the fourth aspect, affine motion model-basedmerge mode is used for inter prediction of the to-be-processed block.The parsing unit is further configured to: when the first identifierindicates that the candidate motion model for inter prediction of thepicture block in the slice including the to-be-processed block includesthe affine motion model, parse the bitstream to obtain a thirdidentifier. When the third identifier is a first value, the affinemotion model includes only a 4-parameter affine model; or when the thirdidentifier is a second value, the affine motion model includes a4-parameter affine model and a 6-parameter affine model. The first valueis different from the second value.

In a possible design of the fourth aspect, the apparatus furtherincludes: a construction unit, configured to: when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, construct a first candidate motion vector list, where thefirst candidate motion vector list includes a first element, and thefirst element includes motion information of three control points forconstructing the 6-parameter affine motion model; or when the secondidentifier indicates that affine motion model-based merge mode is usedfor inter prediction of the to-be-processed block, and the thirdidentifier is the first value, construct a second candidate motionvector list, where the second candidate motion vector list includes asecond element, and the second element includes only motion informationof two control points for constructing the 4-parameter affine motionmodel.

In a possible design of the fourth aspect, when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, the first candidate motion vector list further includesthe second element.

In a possible design of the fourth aspect, the parsing unit is furtherconfigured to: when the second identifier indicates that the affinemotion model-based AMVP mode is used for inter prediction of theto-be-processed block, and the third identifier is the second value,parse the bitstream to obtain a fourth identifier. When the fourthidentifier is a third value, the affine motion model is the 6-parameteraffine motion model, or when the fourth identifier is a fourth value,the affine motion model is the 4-parameter affine motion model. Thethird value is different from the fourth value.

In a possible design of the fourth aspect, when parsing the bitstream toobtain the third identifier, the parsing unit is specifically configuredto parse the slice header of the slice in the bitstream to obtain thethird identifier.

In a possible design of the fourth aspect, before parsing the bitstreamto obtain the first identifier, the parsing unit is further configuredto parse the bitstream to obtain a fifth identifier. When the fifthidentifier is a fifth value, a candidate motion model for interprediction of a picture block in a video picture including theto-be-processed block includes the affine motion model, or when thefifth identifier is a sixth value, a candidate motion model for interprediction of a picture block in a video picture including theto-be-processed block includes only the non-affine motion model. Thefifth value is different from the sixth value.

In a possible design of the fourth aspect, when parsing the bitstream toobtain the fifth identifier, the parsing unit is specifically configuredto parse a sequence parameter set of the bitstream to obtain the fifthidentifier.

In a possible design of the fourth aspect, the parsing unit is furtherconfigured to: after parsing the bitstream to obtain the fifthidentifier, and before parsing the bitstream to obtain the firstidentifier, parse the bitstream to obtain the sixth identifier. Thesixth identifier is used to determine that the bitstream includes thethird identifier.

In a possible design of the fourth aspect, when parsing the bitstream toobtain the sixth identifier, the parsing unit is specifically configuredto parse the sequence parameter set of the bitstream to obtain the sixthidentifier.

In a possible design of the fourth aspect, the preset condition includesthat a width of the to-be-processed block is greater than or equal to afirst preset threshold, and a height of the to-be-processed block isgreater than or equal to a second preset threshold.

In a possible design of the fourth aspect, the first preset threshold isequal to the second preset threshold.

According to a fifth aspect, an embodiment of this application providesan apparatus. The apparatus may be a decoder, and includes a processorand a memory. The memory is configured to store an instruction. When theapparatus runs, the processor executes the instruction stored in thememory, to enable the apparatus to perform the method provided in anyone of the first aspect, the designs of the first aspect, the secondaspect, or the designs of the second aspect. It should be noted that thememory may be integrated into the processor, or may be independent ofthe processor.

According to a sixth aspect, an embodiment of this application providesa video picture prediction method. The method is applied to an encoderside and includes:

-   -   encoding a first identifier into a bitstream; and    -   when the first identifier indicates that a candidate motion        model for inter prediction of a picture block in a video picture        including a to-be-processed block includes an affine motion        model, and the to-be-processed block meets a preset condition        for inter prediction using the affine motion model, encoding a        second identifier into the bitstream, where the second        identifier is used to determine a prediction mode for inter        prediction of the to-be-processed block. The prediction mode        includes an affine motion model-based merge mode, an affine        motion model-based advanced motion vector prediction (AMVP)        mode, and a non-affine motion model-based prediction mode.

In a possible design of the sixth aspect, the encoding a firstidentifier into a bitstream may be implemented in the following manner:encoding the first identifier into a sequence parameter set of thebitstream.

In a possible design of the sixth aspect, when the first identifierindicates that the candidate motion model for inter prediction of thepicture block in the video picture including the to-be-processed blockincludes the affine motion model, the method further includes: encodinga third identifier into the bitstream. When the third identifier is afirst value, the affine motion model includes only a 4-parameter affinemodel; or when the third identifier is a second value, the affine motionmodel includes a 4-parameter affine model and a 6-parameter affinemodel. The first value is different from the second value.

In a possible design of the sixth aspect, the method further includes:when the second identifier indicates that affine motion model-basedmerge mode is used for inter prediction of the to-be-processed block,and the third identifier is the second value, constructing a firstcandidate motion vector list, where the first candidate motion vectorlist includes a first element, and the first element includes motioninformation of three control points for constructing the 6-parameteraffine motion model; or

-   -   when the second identifier indicates that affine motion        model-based merge mode is used for inter prediction of the        to-be-processed block, and the third identifier is the first        value, constructing a second candidate motion vector list, where        the second candidate motion vector list includes a second        element, and the second element includes only motion information        of two control points for constructing the 4-parameter affine        motion model.

In the foregoing design, the third identifier and the second identifierare used to indicate construction of the candidate motion vector lists.

In a possible design of the sixth aspect, when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, the first candidate motion vector list further includesthe second element.

In a possible design of the sixth aspect, the method further includes:when the second identifier indicates that the affine motion model-basedAMVP mode is used for inter prediction of the to-be-processed block, andthe third identifier is the second value, encoding a fourth identifierinto the bitstream. When the fourth identifier is a third value, theaffine motion model is the 6-parameter affine motion model, or when thefourth identifier is a fourth value, the affine motion model is the4-parameter affine motion model. The third value is different from thefourth value.

In a specific embodiment, the fourth identifier is referred to as anidentifier 14.

In a possible design of the sixth aspect, the encoding a thirdidentifier into the bitstream includes: encoding the third identifierinto the sequence parameter set of the bitstream.

According to a seventh aspect, an embodiment of this applicationprovides a video picture prediction method. The method is applied to anencoder side and includes:

-   -   encoding a first identifier into a bitstream; and    -   when the first identifier indicates that a candidate motion        model for inter prediction of a picture block in a slice        including a to-be-processed block includes an affine motion        model, and the to-be-processed block meets a preset condition        for inter prediction using the affine motion model, encoding a        second identifier into the bitstream, where the second        identifier is used to determine a prediction mode for inter        prediction of the to-be-processed block, and the prediction mode        includes an affine motion model-based merge mode, an affine        motion model-based advanced motion vector prediction (AMVP)        mode, and a non-affine motion model-based prediction mode.

In a possible design of the seventh aspect, the encoding a firstidentifier into a bitstream includes: encoding the first identifier intoa slice header of the slice of the bitstream.

In a possible design of the seventh aspect, when the first identifierindicates that the candidate motion model for inter prediction of thepicture block in the slice including the to-be-processed block includesthe affine motion model, the method further includes: encoding a thirdidentifier into the bitstream. When the third identifier is a firstvalue, the affine motion model includes only a 4-parameter affine model;or when the third identifier is a second value, the affine motion modelincludes a 4-parameter affine model and a 6-parameter affine model. Thefirst value is different from the second value.

In a possible design of the seventh aspect, the method further includes:when the second identifier indicates that affine motion model-basedmerge mode is used for inter prediction of the to-be-processed block,and the third identifier is the second value, constructing a firstcandidate motion vector list, where the first candidate motion vectorlist includes a first element, and the first element includes motioninformation of three control points for constructing the 6-parameteraffine motion model; or

-   -   when the second identifier indicates that affine motion        model-based merge mode is used for inter prediction of the        to-be-processed block, and the third identifier is the first        value, constructing a second candidate motion vector list, where        the second candidate motion vector list includes a second        element, and the second element includes only motion information        of two control points for constructing the 4-parameter affine        motion model.

In a possible design of the seventh aspect, when the second identifierindicates that affine motion model-based merge mode is used for interprediction of the to-be-processed block, and the third identifier is thesecond value, the first candidate motion vector list further includesthe second element.

In a possible design of the seventh aspect, the method further includes:when the second identifier indicates that the affine motion model-basedAMVP mode is used for inter prediction of the to-be-processed block, andthe third identifier is the second value, encoding a fourth identifierinto the bitstream.

When the fourth identifier is a third value, the affine motion model isthe 6-parameter affine motion model, or when the fourth identifier is afourth value, the affine motion model is the 4-parameter affine motionmodel. The third value is different from the fourth value.

In a possible design of the seventh aspect, the encoding a thirdidentifier into the bitstream includes: encoding the third identifierinto the slice header of the slice of the bitstream.

In a possible design of the seventh aspect, before the encoding a firstidentifier into a bitstream, the method further includes: encoding afifth identifier into the bitstream. When the fifth identifier is afifth value, a candidate motion model for inter prediction of a pictureblock in a video picture including the to-be-processed block includesthe affine motion model, or when the fifth identifier is a sixth value,a candidate motion model for inter prediction of a picture block in avideo picture including the to-be-processed block includes only thenon-affine motion model. The fifth value is different from the sixthvalue.

In a possible design of the seventh aspect, the encoding a fifthidentifier into the bitstream includes: encoding the fifth identifierinto a sequence parameter set of the bitstream.

In a possible design of the seventh aspect, after the encoding a fifthidentifier into the bitstream and before the encoding a first identifierin a bitstream, the method further includes: encoding a sixth identifierinto the bitstream. The sixth identifier is used to determine that thebitstream includes the third identifier.

It should be noted that the sixth identifier in the seventh aspect isreferred to as an identifier 13 in a specific embodiment.

In a possible design of the seventh aspect, the encoding a sixthidentifier into the bitstream includes: encoding the sixth identifierinto the sequence parameter set of the bitstream.

According to an eighth aspect, an embodiment of this applicationprovides an apparatus. The apparatus may be an encoder, and includes aprocessor and a memory. The memory is configured to store aninstruction. When the apparatus runs, the processor executes theinstruction stored in the memory, to enable the apparatus to perform themethod provided in any one of the third aspect, the designs of the thirdaspect, the fourth aspect, or the designs of the fourth aspect. Itshould be noted that the memory may be integrated into the processor, ormay be independent of the processor.

According to a ninth aspect, this application provides acomputer-readable storage medium. The computer-readable storage mediumstores an instruction; and when the instruction is executed on acomputer, the computer is enabled to perform the method described ineach of the foregoing aspects.

According to a tenth aspect, this application provides a computerprogram product including an instruction. When the computer programproduct is run on a computer, the computer is enabled to perform themethod described in each of the foregoing aspects.

It should be understood that technical solutions of the third to thetenth aspects of this application are consistent with technicalsolutions of the first aspect and the second aspect of this application,and advantageous effects achieved by the aspects and the correspondingimplementable designs are similar. Details are not described again.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of a video encoding and decoding system in animplementation described in an embodiment of this application;

FIG. 2A is a block diagram of a video encoder in an implementationdescribed in an embodiment of this application;

FIG. 2B is a schematic diagram of inter prediction in an implementationdescribed in an embodiment of this application;

FIG. 2C is a block diagram of a video decoder in an implementationdescribed in an embodiment of this application;

FIG. 3 is a schematic diagram of candidate locations of motioninformation in an implementation described in an embodiment of thisapplication;

FIG. 4 is a schematic diagram of prediction of an inherited controlpoint motion vector in an implementation described in an embodiment ofthis application;

FIG. 5A is a schematic diagram of predicting a constructed control pointmotion vector in an implementation described in an embodiment of thisapplication;

FIG. 5B is a schematic flowchart of combining control point motioninformation to obtain constructed control point motion information in animplementation described in an embodiment of this application;

FIG. 6A is a flowchart of an inter prediction method in animplementation described in an embodiment of this application;

FIG. 6B is a schematic diagram of constructing a candidate motion vectorlist in an implementation described in an embodiment of thisapplication;

FIG. 6C is a schematic diagram of a motion compensation unit in animplementation described in an embodiment of this application;

FIG. 7 is a schematic flowchart of a video picture prediction methodaccording to an embodiment of this application;

FIG. 8 is a schematic flowchart of an inter prediction method accordingto an embodiment of this application;

FIG. 9 is a schematic flowchart of another video picture predictionmethod according to an embodiment of this application;

FIG. 10 is a schematic flowchart of an inter prediction method accordingto an embodiment of this application;

FIG. 11 is a schematic flowchart of still another video pictureprediction method according to an embodiment of this application;

FIG. 12 is a schematic diagram of an apparatus 1200 according to anembodiment of this application;

FIG. 13 is a schematic diagram of an apparatus 1300 according to anembodiment of this application; and

FIG. 14 is a schematic diagram of an apparatus 1400 according to anembodiment of this application.

DESCRIPTION OF EMBODIMENTS

A video picture prediction solution provided in the embodiments of thisapplication may be applied to video picture encoding or decoding. FIG. 1is a schematic block diagram of a video encoding and decoding system 10according to an embodiment of this application. As shown in FIG. 1 , thesystem 10 includes a source apparatus 11 and a destination apparatus 12.The source apparatus 11 generates encoded video data and sends theencoded video data to the destination apparatus 12. The destinationapparatus 12 is configured to receive the encoded video data, decode theencoded video data, and display the decoded video data. The sourceapparatus 11 and the destination apparatus 12 may include any one of awide range of apparatuses, including a desktop computer, a laptopcomputer, a tablet computer, a set-top box, a mobile phone such as a“smart” phone, a “smart” touch panel, a television set, a camera, adisplay apparatus, a digital media player, a video gaming console, avideo streaming transmission apparatus, and the like.

A solution for predicting an intra mode of a picture block provided inthe embodiments of this application may be applied to video pictureencoding or decoding.

The destination apparatus 12 may receive the to-be-decoded encoded videodata through a link 16. The link 16 may include any type of media orapparatuses that can transfer the encoded video data from the sourceapparatus 11 to the destination apparatus 12. In a possibleimplementation, the link 16 may include a communications medium thatenables the source apparatus 11 to directly transmit the encoded videodata to the destination apparatus 12 in real time. The encoded videodata may be modulated according to a communications standard (forexample, a wireless communications protocol), and modulated encodedvideo data is transmitted to the destination apparatus 12. Thecommunications medium may include any wireless or wired communicationsmedium, for example, a radio frequency spectrum or one or more physicaltransmission lines. The communications medium may be a part of apacket-based network (for example, a local area network, a wide areanetwork, or a global network of the Internet). The communications mediummay include a router, a switch, a base station, or any other deviceconfigured to facilitate communication between the source apparatus 11and the destination apparatus 12.

Alternatively, the video encoding and decoding system 10 furtherincludes a storage apparatus. The encoded data may be output to thestorage apparatus through an output interface 14. Similarly, the encodeddata may be accessed from the storage apparatus through an inputinterface 15. The storage apparatus may include any one of a variety ofdistributed or local-access data storage media, for example, a hard diskdrive, a Blu-ray disc, a DVD, a CD-ROM, a flash memory, a volatile ornon-volatile memory, or any other appropriate digital storage mediumused to store the encoded video data. In another feasibleimplementation, the storage apparatus may correspond to a file server oranother intermediate storage apparatus that can maintain the encodedvideo generated by the source apparatus 11. The destination apparatus 12may access the stored video data from the storage apparatus throughstreaming transmission or downloading. The file server may be any typeof server that can store the encoded video data and transmit the encodedvideo data to the destination apparatus 12. In a feasibleimplementation, the file server includes a website server, a filetransfer protocol server, a network-attached storage apparatus, or alocal disk drive. The destination apparatus 12 may access the encodedvideo data through any standard data connection including an internetconnection. The data connection may include a wireless channel (forexample, a Wi-Fi connection), a wired connection (for example, a cablemodem), or a combination thereof. The wireless channel or the wiredconnection is suitable for accessing the encoded video data stored inthe file server. Transmission of the encoded video data from the storageapparatus may be streaming transmission, downloading transmission, or acombination thereof.

The technologies in this application are not necessarily limited towireless applications or settings. The technologies may be applied tovideo decoding, to support any one of a variety of multimediaapplications, for example, over-the-air television broadcasting, cabletelevision transmission, satellite television transmission, streamingvideo transmission (for example, through the internet), digital videoencoding for storage on a data storage medium, decoding of a digitalvideo stored on a data storage medium, or another application. In somepossible implementations, the system 10 may be configured to supportunidirectional or bidirectional video transmission, so as to supportapplications such as streaming video transmission, video playing, videobroadcasting, and/or video calling.

In a possible implementation of FIG. 1 , the source apparatus 11 mayinclude a video source 13, a video encoder 20, and an output interface14. In some applications, the output interface 14 may include amodulator/demodulator (a modem) and/or a transmitter. In the sourceapparatus 11, the video source 13 may include, for example, thefollowing source devices: a video capture apparatus (for example, acamera), an archive containing a previously captured video, a videofeed-in interface for receiving a video from a video content provider,and/or a computer graphics system used to generate computer graphicsdata as a source video, or a combination thereof. In a possibleimplementation, if the video source 13 is a camera, the source apparatus11 and the destination apparatus 12 may constitute a camera phone or avideo phone. For example, the technologies described in this applicationmay be applied to, for example, video decoding, and may be applied towireless and/or wired applications.

The video encoder 20 may encode, capture, pre-capture, or calculate agenerated video. The encoded video data may be directly transmitted tothe destination apparatus 12 through the output interface 14 of thesource apparatus 11. The encoded video data may also (or alternatively)be stored on the storage apparatus for later access by the destinationapparatus 12 or another apparatus for decoding and/or playing.

The destination apparatus 12 includes the input interface 15, a videodecoder 30, and a display apparatus 17. In some applications, the inputinterface 15 may include a receiver and/or a modem. The input interface15 of the destination apparatus 12 receives the encoded video datathrough the link 16. The encoded video data transmitted or provided tothe storage apparatus through the link 16 may include a variety ofsyntax elements generated by the video encoder 20 for the video decoder30 to decode video data. These syntax elements may be included togetherwith the encoded video data that is transmitted on the communicationsmedium and that is stored on the storage medium or the file server.

The display apparatus 17 may be integrated with the destinationapparatus 12, or may be located outside the destination apparatus 12. Insome possible implementations, the destination apparatus 12 may includean integrated display apparatus, and may also be configured to connectto an interface of an external display apparatus. In another possibleimplementation, the destination apparatus 12 may be a display apparatus.Generally, the display apparatus 17 displays decoded video data to auser, and may include any of a variety of display apparatuses, forexample, a liquid crystal display, a plasma display, an organiclight-emitting diode display, or another type of display apparatus.

The video encoder 20 and the video decoder 30 may operate according to,for example, a next-generation video coding compression standard (H.266)that is currently being developed, and may comply with an H.266 testmodel (JEM). Alternatively, the video encoder 20 and the video decoder30 may operate according to, for example, other dedicated or industrialstandards such as the ITU-T H.265 standard or the ITU-T H.264 standardor extensions thereof, where the ITU-T H.265 standard is also referredto as the high efficiency video coding standard, and the ITU-T H.264standard is also referred to as MPEG-4 Part 10, or advanced video coding(advanced video coding, AVC). However, the technologies in thisapplication are not limited to any specific decoding standard. Otherpossible implementations of the video compression standard includeMPEG-2 and ITU-TH.263.

Although not shown in FIG. 1 , in some aspects, the video encoder 20 andthe video decoder 30 may be integrated with an audio encoder and anaudio decoder, respectively, and may include an appropriatemultiplexer-demultiplexer (MUX-DEMUX) unit or other hardware andsoftware to encode both audio and a video in a common data stream orseparate data streams. If applicable, in some feasible implementations,the MUX-DEMUX unit may comply with the ITU H.223 multiplexer protocol orother protocols such as a user datagram protocol (UDP).

The video encoder 20 and the video decoder 30 may be separatelyimplemented as any one of a variety of appropriate encoder circuits, forexample, one or more microprocessors, a digital signal processor(digital signal processor, DSP), an application-specific integratedcircuit (application-specific integrated circuit, ASIC), afield-programmable gate array (field-programmable gate array, FPGA),discrete logic, software, hardware, firmware, or any combinationthereof. When some of the techniques are implemented as software, anapparatus may store an instruction for the software into an appropriatenon-transitory computer-readable medium, and execute the instruction ina form of hardware by using one or more processors, to implement thetechniques of this application. Each of the video encoder 20 and thevideo decoder 30 may be included in one or more encoders or decoders,and either the video encoder 20 or the video decoder 30 may beintegrated as a part of a combined encoder/decoder (CODEC) in acorresponding apparatus.

The JCT-VC has developed the H.265 (HEVC) standard. HEVC standardizationis based on an evolved model of a video decoding apparatus, where themodel is referred to as an HEVC test model (HM). A latest H.265 standarddocument is available at http://www.itu.int/rec/T-REC-H.265. A latestversion of the standard document is H.265 (12/16), and the standarddocument is incorporated herein by reference in its entirety. In the HM,it is assumed that the video decoding apparatus has several additionalcapabilities relative to an existing algorithm of ITU-TH.264/AVC.

JVET is committed to developing the H.266 standard. An H.266standardization process is based on an evolved model of the videodecoding apparatus, where the model is referred to as the H.266 testmodel. H.266 algorithm descriptions are available athttp://phenix.int-evry.fr/j vet, and latest algorithm descriptions areincluded in JVET-F1001-v2. A document of the algorithm descriptions isincorporated herein by reference in its entirety. In addition, referencesoftware for a JEM test model is available athttps://jvet.hhi.fraunhofer.de/svn/svn_HMJEMSoftware/, and is alsoincorporated herein by reference in its entirety.

Generally, in descriptions of an HM working model, a video frame orpicture may be split into a sequence of tree blocks including both lumaand chroma samples or a sequence of largest coding units (largest codingunit, LCU), where the LCU is also referred to as CTU. A tree block has afunction similar to that of a macroblock in the H.264 standard. A sliceincludes several consecutive tree blocks in a decoding order. The videoframe or picture may be partitioned into one or more slices. Each treeblock can be split into coding units based on a quadtree. For example, atree block serving as a root node of the quadtree may be split into fourchild nodes, and each child node may also serve as a parent node and issplit into four other child nodes. A final non-splittable child nodeserving as a leaf node of the quadtree includes a decoding node, forexample, a decoded picture block. In syntactic data associated with adecoded bitstream, a maximum quantity of splits of a tree block and aminimum size of a decoding node may be defined.

A coding unit includes a decoding node, a prediction unit (predictionunit, PU), and a transform unit (transform unit, TU) associated with thedecoding node. A size of the CU corresponds to a size of the decodingnode, and a shape of the CU needs to square. The size of the CU mayrange from 8×8 pixels to a maximum of 64×64 pixels, or may be a largertree block size. Each CU may include one or more PUs and one or moreTUs. For example, syntactic data associated with the CU may describepartitioning of a CU into one or more PUs. A different partitioning modemay be used if the CU is encoded in a skip mode, a direct mode, an intraprediction mode, or an inter prediction mode. The PU obtained throughpartitioning may be in a non-square shape. For example, the syntacticdata associated with the CU may also describe partitioning of a CU intoone or more TUs based on the quadtree. The TU may be in a square ornon-square shape.

The HEVC standard allows TU-based transform. Different CUs may includedifferent TUs. A size of a TU is usually set based on a size of a PUwithin a given CU defined for a partitioned LCU. However, a case may notalways be like this. The size of the TU is usually the same as or lessthan that of the PU. In some feasible implementations, a quadtreestructure referred to as a “residual quadtree” (residual quadtree, RQT)may be used to divide a residual sample corresponding to a CU intosmaller units. A leaf node of the RQT may be referred to as a TU. Apixel difference associated with the TU may be transformed to generate atransform coefficient, and the transform coefficient may be quantized.

Generally, a PU includes data related to a prediction process. Forexample, when the PU is encoded in an intra mode, the PU may includedata describing an intra prediction mode of the PU. In another feasibleimplementation, when the PU is encoded in an inter mode, the PU mayinclude data defining a motion vector for the PU. For example, the datadefining the motion vector for the PU may describe a horizontalcomponent of the motion vector, a vertical component of the motionvector, resolution (for example, ¼ pixel precision or ⅛ pixel precision)of the motion vector, a reference picture to which the motion vectorpoints, and/or a reference picture list (for example, a list 0, a list1, or a list C) of the motion vector.

Generally, transform and quantization processes are used for a TU. Agiven CU including one or more PUs may also include one or more TUs.After prediction, the video encoder 20 may calculate a residual valuecorresponding to a PU. The residual value includes a pixel difference.The pixel difference may be transformed into a transform coefficient,and the transform coefficient is quantized and is scanned by using a TU,to generate serialized transform coefficients for entropy decoding. Inthis application, the term “picture block” is usually used to representa decoding node of a CU. In some specific applications, in thisapplication, the term “picture block” may also be used to represent atree block including a decoding node, a PU, and a TU, for example, anLCU or a CU.

The video encoder 20 encodes video data. The video data may include oneor more pictures. The video encoder 20 may generate a bitstream, and thebitstream includes encoded information of video data in a form of a bitstream. The encoded information may include encoded picture data andassociated data. The associated data may include a sequence parameterset (sequence paramater set, SPS), a picture parameter set (pictureparameter set, PPS), and another syntax structure. The SPS may include aparameter applied to zero or a plurality of sequences. The SPS describesa higher-layer parameter of a general characteristic of a coded videosequence (coded video sequence, CVS), and the sequence parameter set(SPS) includes information required by all slices (slice) in the CVS.The PPS may include a parameter applied to zero or a plurality ofpictures. The syntax structure is a set of zero or a plurality of syntaxelements arranged in the bitstream in a specified order.

In a feasible implementation, HM supports prediction for a variety of PUsizes. Assuming that a size of a specific CU is 2 N×2 N, the HM supportsintra prediction for a PU size of 2 N×2 N or N×N, and inter predictionfor a symmetric PU size of 2 N×2 N, 2 N×N, N×2 N, or N×N. HM alsosupports asymmetric partitioning for inter prediction for PU sizes of 2N×nU, 2 N×nD, nL×2 N, and nR×2 N. In asymmetric partitioning, the CU isnot partitioned in a direction, and is partitioned into two parts inanother direction, where one part accounts for 25% of the CU and theother part accounts for 75% of the CU. The part accounting for 25% ofthe CU is indicated by an indicator including “n” followed by “U (Up)”,“D (Down)”, “L (Left)” or “R (Right)”. Therefore, for example, “2 N×nU”refers to a horizontally partitioned 2 N×2 N CU, with a 2 N×0.5 N PU atthe top and a 2 N×1.5 N PU at the bottom.

In this application, “N×N” and “N by N” may be used interchangeably toindicate a pixel size of a picture block in a vertical dimension and ahorizontal dimension, for example, 16×16 pixels or 16 by 16 pixels.Usually, a 16×16 block has 16 pixels in a vertical direction (y=16) and16 pixels in a horizontal direction (x=16). Similarly, an N×N blockusually has N pixels in a vertical direction and N pixels in ahorizontal direction, where N is a nonnegative integer value. Pixels ina block may be arranged in rows and columns. In addition, in a block, aquantity of pixels in the horizontal direction and a quantity of pixelsin the vertical direction may not be necessarily the same. For example,a block may include N×M pixels, where M is not necessarily equal to N.

After decoding a PU in a CU in an intra or inter prediction mode, thevideo encoder 20 may calculate residual data of a TU in the CU. The PUmay include pixel data in a space domain (which is also referred to as apixel domain), and the TU may include a coefficient in a transformdomain obtained after transform (for example, discrete cosine transform(discrete cosine transform, DCT), integer transform, wavelet transform,or other conceptually similar transform) is applied to residual videodata. The residual data may correspond to a pixel difference between apixel of an unencoded picture and a predictor corresponding to the PU.The video encoder 20 may generate a TU including residual data of theCU, and then transform the TU to generate a transform coefficient of theCU.

The JEM model further improves a video picture coding structure.Specifically, a block coding structure referred to as a “quadtree plusbinary tree” (QTBT) structure is introduced. Without using concepts suchas CU, PU, and TU in HEVC, the QTBT structure supports more flexible CUsplit shapes. A CU may be in a square shape or rectangular shape.Quadtree partitioning is first performed on a CTU, and binary treepartitioning is further performed on a leaf node of the quadtree. Inaddition, there are two binary tree partitioning modes: symmetrichorizontal partitioning and symmetric vertical partitioning. A leaf nodeof a binary tree is referred to as a CU. The CU in the JEM model isfurther split neither in a prediction process nor in a transformprocess. In other words, the CU, the PU, and the TU in the JEM modelhave a same block size. In the existing JEM model, a maximum CTU size is256×256 luma pixels.

FIG. 2A is a schematic block diagram of a video encoder 20 according toan embodiment of this application.

As shown in FIG. 2A, the video encoder 20 may include a predictionmodule 21, a summator 22, a transform module 23, a quantization module24, and an entropy encoding module 25. In an example, the predictionmodule 21 may include an inter prediction module 211 and an intraprediction module 212. An internal structure of the prediction module 21is not limited in this embodiment of this application. Optionally, thevideo encoder 20 with a hybrid architecture may also include an inversequantization module 26, an inverse transform module 27, and a summator28.

In a feasible implementation of FIG. 2A, the video encoder 20 mayfurther include a storage module 29. It should be understood that thestorage module 29 may alternatively be disposed outside the videoencoder 20.

In another feasible implementation, the video encoder 20 may furtherinclude a filter (which is not shown in FIG. 2A) to filter a boundary ofa picture block, so as to eliminate an artifact from a reconstructedvideo picture. When necessary, the filter usually filters an output fromthe summator 28.

Optionally, the video encoder 20 may further include a partitioning unit(which is not shown in FIG. 2A). The video encoder 20 receives videodata, and the partitioning unit partitions the video data into pictureblocks. Such partitioning may further include partitioning into slices,picture blocks, or other larger units, and (for example) partitioninginto picture blocks that is performed based on quadtree structures of anLCU and a CU. The video encoder 20 describes, for example, a componentfor encoding a picture block in a to-be-encoded video slice. A slice mayusually be split into a plurality of picture blocks (and may be splitinto a set of picture blocks). Slice types include I (which is mainlyused for intra-picture encoding), P (which is used for inter forwardreference prediction picture encoding), and B (which is used for interbidirectional reference prediction picture encoding).

The prediction module 21 is configured to perform intra or interprediction on a picture block that needs to be currently processed, toobtain a predictor (which may be referred to as predicted information inthis application) of the current block. In this embodiment of thisapplication, the picture block that needs to be currently processed maybe a to-be-processed block for short, may be a current picture block forshort, or may be the current block for short. Alternatively, the pictureblock that needs to be currently processed in an encoding phase may bereferred to as a current coding block (encoding block) for short, andthe picture block that needs to be currently processed in a decodingphase may be referred to as a current coding block (decoding block).

Specifically, the inter prediction module 211 included in the predictionmodule 21 performs inter prediction on the current block, to obtain aninter predictor. The intra prediction module 212 performs intraprediction on the current block, to obtain an intra predictor. The interprediction module 211 searches a reconstructed picture for a matchedreference block for a current block in a current picture; uses a samplevalue of a sample in the reference block as predicted information or apredictor of a sample value of a sample in the current block (thefollowing does not distinguish information from a value), where thisprocess is referred to as motion estimation (Motion estimation, ME) (asshown in FIG. 2B); and transmits motion information of the currentblock.

It should be noted that the motion information of the picture blockincludes indication information of a prediction direction (which isusually forward prediction, backward prediction, or bidirectionalprediction), one or two motion vectors (Motion vector, MV) to which thereference block points, and indication information (which is oftendenoted as a reference picture index, Reference index) of a picture inwhich the reference block is located.

Forward prediction means selecting a reference picture from a forwardreference picture set, to obtain a reference block for the currentblock. Backward prediction means selecting a reference picture from abackward reference picture set, to obtain a reference block for thecurrent block. Bidirectional prediction means selecting a referencepicture from a forward reference picture set and a reference picturefrom a backward reference picture set, to obtain reference blocks. Whena bidirectional prediction method is used, there are two referenceblocks for the current block. Each reference block needs to be indicatedby using a motion vector and a reference picture index, and then thepredictor of the sample value of the sample in the current block isdetermined based on pixel values of samples in the two reference blocks.

In the motion estimation process, a plurality of reference blocks in thereference picture needs to be tried for the current block, and which oneor more specific reference blocks are finally used for prediction isdetermined through rate-distortion optimization (Rate-distortionoptimization, RDO) or by using another method.

After the prediction module 21 generates the predictor of the currentblock through inter prediction or intra prediction, the video encoder 20subtracts the predictor from the current block, to generate residualinformation. The transform module 23 is configured to transform theresidual information. The transform module 23 applies a transform suchas discrete cosine transform (discrete cosine transformation, DCT) or aconceptually similar transform (for example, discrete sine transformDST) to transform the residual information into a residual transformcoefficient. The transform module 23 may send the obtained residualtransform coefficient to the quantization module 24. The quantizationmodule 24 quantizes the residual transform coefficient to further reducea code rate. In some feasible implementations, the quantization module24 may continue to scan a matrix including the quantized transformcoefficient. Alternatively, the entropy encoding module 25 may performscanning.

After quantization, the entropy encoding module 25 may perform entropyencoding on the quantized residual transform coefficient to obtain abitstream. For example, the entropy encoding module 25 may performcontext-adaptive variable-length decoding (CAVLC), context-basedadaptive binary arithmetic decoding (CABAC), syntax-basedcontext-adaptive binary arithmetic decoding (SBAC), probability intervalpartitioning entropy (PIPE) decoding, or another entropy encodingmethodology or technology. After the entropy encoding module 25 performsentropy encoding, an encoded bitstream may be transmitted to the videodecoder 30, or archived for future transmission or retrieval by thevideo decoder 30.

The inverse quantization module 26 and the inverse transform module 27perform inverse quantization and inverse transform respectively, toreconstruct a residual block in a pixel domain as a reference block in areference picture. The summator 28 adds residual information obtainedthrough reconstruction and the predictor generated by the predictionmodule 21, to generate a reconstructed block, and uses the reconstructedblock as the reference block for storage in the storage module 29. Thereference blocks may be used by the prediction module 21 to performinter or intra prediction on blocks in a subsequent video frame orpicture.

It should be understood that another structural variant of the videoencoder 20 can be used to encode a video stream. For example, for somepicture blocks or picture frames, the video encoder 20 may directlyquantize the residual information without processing by the transformmodule 23 or processing by the inverse transform module 27.Alternatively, for some picture blocks or picture frames, the videoencoder 20 does not generate residual information, and correspondingly,processing by the transform module 23, the quantization module 24, theinverse quantization module 26, and the inverse transform module 27 isnot required. Alternatively, the video encoder 20 may directly store areconstructed picture block as a reference block without processing by afilter unit. Alternatively, the quantization module 24 and the inversequantization module 26 in the video encoder 20 may be combined together.Alternatively, the transform module 23 and the inverse transform module27 in the video encoder 20 may be combined together. Alternatively, thesummator 22 and the summator 28 may be combined together.

FIG. 2C is a schematic block diagram of a video decoder 30 according toan embodiment of this application.

As shown in FIG. 2C, the video decoder 30 may include an entropydecoding module 31, a prediction module 32, an inverse quantizationmodule 34, an inverse transform module 35, and a reconstruction module36. In an example, the prediction module 32 may include a motioncompensation module 322 and an intra prediction module 321. This is notlimited in this embodiment of this application.

In a feasible implementation, the video decoder 30 may further include astorage module 33. It should be understood that the storage module 33may alternatively be disposed outside the video decoder 30. In somefeasible implementations, the video decoder 30 may perform an exampledecoding procedure inverse to the encoding procedure of the videoencoder 20 in FIG. 2A.

In the decoding process, the video decoder 30 receives a bitstream fromthe video encoder 20. The entropy decoding module 31, the inversequantization module 34, and the inverse transform module 35 successivelyperform respectively entropy decoding, inverse quantization, and inversetransform on the bitstream received by the video decoder 30, to obtainresidual information. Whether intra prediction or inter prediction isperformed on the current block is determined based on the bitstream. Ifintra prediction is performed, the intra prediction module 321 in theprediction module 32 constructs predicted information based on a usedintra prediction method and pixel values of reference pixels ofreconstructed blocks around the current block. If inter prediction isperformed, the motion compensation module 322 needs to obtain motioninformation through parsing, determines a reference block from areconstructed picture block based on the motion information parsed, anduses a sample value of a sample in the reference block as predictedinformation (where this process is referred to as motion compensation(motion compensation, MC)). The reconstruction module 36 can obtainreconstruction information by using the predicted information and theresidual information.

As noted in the foregoing, this application relates to, for example,inter decoding. Therefore, specific technologies of this application maybe executed by the motion compensation module 322. In other feasibleimplementations, one or more other units of the video decoder 30 mayadditionally or alternatively be responsible for executing thetechnologies of this application.

The following first describes concepts in this application.

(1) Inter Prediction Mode

In HEVC, two inter prediction modes are used: an advanced motion vectorprediction (advanced motion vector prediction, AMVP) mode and a merge(merge) mode.

In the AMVP mode, spatial or temporal neighboring encoded blocks(denoted as neighboring blocks) of a current block are first traversed,a candidate motion vector list (which may also be referred to as amotion information candidate list) is constructed based on motioninformation of each neighboring block, an optimal motion vector isdetermined from the candidate motion vector list by usingrate-distortion costs, and candidate motion information with a minimumrate-distortion cost is used as a motion vector predictor (motion vectorpredictor, MVP) of the current block. Both locations of the neighboringblocks and a traversal order the neighboring blocks are predefined. Therate-distortion cost is calculated according to formula (1), where Jrepresents a rate-distortion cost (RD Cost), SAD is a sum of absolutedifferences (sum of absolute differences, SAD) between an original pixelvalue and a predicted pixel value obtained through motion estimation byusing the candidate motion vector predictor, R represents a bit rate,and represents a Lagrange multiplier. An encoder side transfers an indexvalue of the selected motion vector predictor in the candidate motionvector list and a reference picture index value to a decoder side.Further, motion search is performed in a neighborhood with the MVP as acenter, to obtain an actual motion vector of the current block. Theencoder side transfers a difference (motion vector difference) betweenthe MVP and an actual motion vector to the decoder side.

J=SAD+λR  (1)

In the merge mode, a candidate motion vector list is first constructedby using motion information of spatial or temporal neighboring encodedblock of a current block, then optimal motion information is determinedfrom the candidate motion vector list by calculating a rate-distortioncost and is used as motion information of the current block, and then anindex value (which is denoted as a merge index, same hereinafter) of alocation of the optimal motion information in the candidate motionvector list is transferred to a decoder side. FIG. 3 shows spatial andtemporal candidate motion information of the current block. The spatialcandidate motion information comes from five spatial neighboring blocks(A0, A1, B0, B1, and B2). If the neighboring blocks are unavailable(there is no neighboring block, the neighboring blocks are not encoded,or a prediction mode used by the neighboring blocks is not the interprediction mode), motion information of the neighboring blocks is notadded to the candidate motion vector list. The temporal candidate motioninformation of the current block is obtained by scaling an MV of a blockin a corresponding location in a reference frame based on picture ordercounts (picture order count, POC) of a reference frame and a currentframe. Whether a block in a location T in the reference frame isavailable is first determined. If the block is unavailable, a block in alocation C is selected.

Similar to the AMVP mode, in the merge mode, both locations of theneighboring blocks and a traversal order of the neighboring blocks arealso predefined. In addition, the locations of the neighboring blocksand the transversal order of the neighboring blocks may differ indifferent modes.

It can be learned that a candidate motion vector list needs to bemaintained in both the AMVP mode and the merge mode. Before new motioninformation is added to the candidate list each time, whether the samemotion information already exists in the list is first checked. If thesame motion information exists in the list, the motion information isnot added to the list. This check process is referred to as pruning ofthe candidate motion vector list. The list is pruned to avoid the samemotion information in the list, thereby avoiding redundantrate-distortion cost calculation.

In inter prediction in HEVC, same motion information is used for allpixels in a coding block, and then motion compensation is performedbased on the motion information, to obtain predictors of the pixels ofthe coding block. In the coding block, however, not all pixels have samemotion features. Using the same motion information may result ininaccurate motion compensation prediction and more residual information.

In existing video coding standards, block matching motion estimationbased on a translational motion model is used, and it is assumed thatmotion of all pixels in a block is consistent. However, in the realworld, there are a variety of motion. Many objects are innon-translational motion, for example, a rotating object, a rollercoaster spinning in different directions, a display of fireworks, andsome stunts in movies, especially a moving object in a UGC scenario. Forthese moving objects, if a block motion compensation technology based ona translational motion model in the existing coding standards is usedfor coding, coding efficiency may be greatly affected. In this case, anon-translational motion model, for example, an affine motion model, isintroduced to further improve the coding efficiency.

On this basis, in terms of different motion models, the AMVP mode may beclassified into a translational model-based AMVP mode and anon-translational model-based AMVP mode, and the merge mode may beclassified into a translational model-based merge mode and anon-translational motion model-based merge mode.

(2) Non-Translational Motion Model

Non-translational motion model prediction means that an encoder/decoderside derives motion information of each motion compensation subunit in acurrent block by using a same motion model, and performs motioncompensation based on the motion information of the motion compensationsubunit to obtain a prediction block, thereby improving predictionefficiency. Common non-translational motion models include a 4-parameteraffine motion model or a 6-parameter affine motion model.

The motion compensation subunit in this embodiment of this applicationmay be a sample or a pixel block that has a size of N₁×N₂ and that isobtained through partitioning according to a specific method, where bothN₁ and N₂ are positive integers, and N₁ may be equal to N₂, or may benot equal to N₂.

The 4-parameter affine motion model is expressed as formula (2):

$\begin{matrix}\{ \begin{matrix}{{vx} = {a_{1} + {a_{3}x} + {a_{4}y}}} \\{{vy} = {a_{2} - {a_{4}x} + {a_{3}y}}}\end{matrix}  & (2)\end{matrix}$

The 4-parameter affine motion model may be represented by using motionvectors of two samples and coordinates of the two samples relative tothe top-left sample of the current block. A sample used for representinga motion model parameter is referred to as a control point. If thetop-left sample (0, 0) and the top-right sample (W, 0) are used ascontrol points, motion vectors (vx0, vy0) and (vx1, vy1) of the controlpoints of the top-left sample and the top-right sample of the currentblock are first determined, and then motion information of each motioncompensation subunit in the current block is obtained according to aformula (3), where (x, y) are coordinates of the motion compensationsubunit relative to the top-left sample of the current block, and W isthe width of the current block.

$\begin{matrix}\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} - {\frac{{vy}_{1} - {vy}_{0}}{W}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vx}_{1} - {vx}_{0}}{W}y} + {vy}_{0}}}\end{matrix}  & (3)\end{matrix}$

The 6-parameter affine motion model is expressed as formula (4):

$\begin{matrix}\{ \begin{matrix}{{vx} = {a_{1} + {a_{3}x} + {a_{4}y}}} \\{{vy} = {a_{2} + {a_{5}x} + {a_{6}y}}}\end{matrix}  & (4)\end{matrix}$

The 6-parameter affine motion model may be represented by using motionvectors of three samples and coordinates of the three samples relativeto the top-left sample of the current block. If the top-left sample (0,0), the top-right sample (W, 0), and the bottom-left sample (0, H) areused as control points, motion vectors of the top-left control point,the top-right control point, and the bottom-left control point of thecurrent block are first determined as (vx0, vy0), (vx1, vy1), and (vx2,vy2), respectively. Then motion information of each motion compensationsubunit in the current block is obtained according to formula (5). (x,y) are coordinates of the motion compensation subunit relative to thetop-left sample of the current block, and W and H are respectively thewidth and the height of the current block.

$\begin{matrix}\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} + {\frac{{vx}_{2} - {vy}_{0}}{H}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vy}_{2} - {vx}_{0}}{H}y} + {vy}_{0}}}\end{matrix}  & (5)\end{matrix}$

A coding block predicted by using an affine motion model is referred toas an affine coding block.

Motion information of a control point of the affine coding block mayusually be obtained by using an affine motion model-based advancedmotion vector prediction (Advanced Motion Vector Prediction, AMVP) modeor an affine motion model-based merge (Merge) mode.

The motion information of the control point of the current encodingblock may be obtained by using a method for predicting an inheritedcontrol point motion vector or a constructed control point motionvector.

(3) Method for Predicting an Inherited Control Point Motion Vector

The method for predicting the inherited control point motion vector isdetermining a candidate control point motion vector of a current blockby using a motion model of a neighboring encoded affine coding block.

A current block shown in FIG. 4 is used as an example. Blocks inneighboring locations around the current block are traversed in aspecified order, for example, an order A1→B1→B0→A0→B2, to find affinecoding blocks in which the blocks in the neighboring locations of thecurrent block are located, and obtain control point motion informationof the affine coding blocks. Further, control point motion vectors(which are used in the merge mode) or a control point motion vectorpredictor (which is used in the AMVP mode) of the current block isfurther derived by using motion models constructed by using the controlpoint motion information of the affine coding blocks. The orderA1→B1→B0→A0→B2 is merely used as an example. An order of anothercombination is also applicable to this application. In addition, theblocks in the neighboring locations are not limited to A1, B1, B0, A0,and B2.

A block in a neighboring location may be a sample or a pixel block of apreset size obtained through partitioning according to a specificmethod. For example, the pixel block may be a 4×4 pixel block, a 4×2pixel block, or a pixel block of another size, and is not limited.

The following describes a determining process by using A1 as an example,and another case is similar thereto.

As shown in FIG. 4 , if a coding block in which A1 is located is a4-parameter affine coding block, a motion vector (vx4, vy4) of thetop-left sample (x4, y4) of the affine coding block and a motion vector(vx5, vy5) of the top-right sample (x5, y5) of the affine coding blockare obtained. A motion vector (vx0, vy0) of the top-left sample (x0, y0)of the current affine coding block is calculated according to formula(6), and a motion vector (vx1, vy1) of the top-right sample (x1, y1) ofthe current affine coding block is calculated according to formula (7).

$\begin{matrix}\{ \begin{matrix}{{vx}_{0} = {{vx}_{4} + {\frac{( {{vx}_{5} - {vx}_{4}} )}{x_{5} - x_{4}} \times ( {x_{0} - x_{4}} )} - {\frac{( {{vy}_{5} - {vy}_{4}} )}{x_{5} - x_{4}} \times ( {y_{0} - y_{4}} )}}} \\{{vy}_{0} = {{vy}_{4} + {\frac{( {{vy}_{5} - {vy}_{4}} )}{x_{5} - x_{4}} \times ( {x_{0} - x_{4}} )} + {\frac{( {{vx}_{5} - {vx}_{4}} )}{x_{5} - x_{4}} \times ( {y_{0} - y_{4}} )}}}\end{matrix}  & (6)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx}_{1} = {{vx}_{4} + {\frac{( {{vx}_{5} - {vx}_{4}} )}{x_{5} - x_{4}} \times ( {x_{1} - x_{4}} )} - {\frac{( {{vy}_{5} - {vy}_{4}} )}{x_{5} - x_{4}} \times ( {y_{1} - y_{4}} )}}} \\{{vy}_{1} = {{vy}_{4} + {\frac{( {{vy}_{5} - {vy}_{4}} )}{x_{5} - x_{4}} \times ( {x_{1} - x_{4}} )} + {\frac{( {{vx}_{5} - {vx}_{4}} )}{x_{5} - x_{4}} \times ( {y_{1} - y_{4}} )}}}\end{matrix}  & (7)\end{matrix}$

A combination of the motion vector (vx0, vy0) of the top-left sample(x0, y0) of the current block and the motion vector (vx1, vy1) of thetop-right sample (x1, y1) of the current block that are obtained basedon the affine coding block in which A1 is located is the candidatecontrol point motion vector of the current block.

If a coding block in which A1 is located is a 6-parameter affine codingblock, a motion vector (vx4, vy4) of the top-left sample (x4, y4) of theaffine coding block, a motion vector (vx5, vy5) of the top-right sample(x5, y5) of the affine coding block, and a motion vector (vx6, vy6) ofthe bottom-left sample (x6, y6) of the affine coding block are obtained.A motion vector (vx0, vy0) of the top-left sample (x0, y0) of thecurrent block is calculated according to formula (8), a motion vector(vx1, vy1) of the top-right sample (x1, y1) of the current block iscalculated according to formula (9), and a motion vector (vx2, vy2) ofthe bottom-left sample (x2, y2) of the current block is calculatedaccording to formula (10).

$\begin{matrix}\{ \begin{matrix}{{vx}_{0} = {{vx}_{4} + {\frac{( {{vx}_{5} - {vx}_{4}} )}{x_{5} - x_{4}} \times ( {x_{0} - x_{4}} )} + {\frac{( {{vx}_{6} - {vx}_{4}} )}{y_{6} - y_{4}} \times ( {y_{0} - y_{4}} )}}} \\{{vy}_{0} = {{vy}_{4} + {\frac{( {{vy}_{5} - {vy}_{4}} )}{x_{5} - x_{4}} \times ( {x_{0} - x_{4}} )} + {\frac{( {{vy}_{6} - {vy}_{4}} )}{y_{6} - y_{4}} \times ( {y_{0} - y_{4}} )}}}\end{matrix}  & (8)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx}_{1} = {{vx}_{4} + {\frac{( {{vx}_{5} - {vx}_{4}} )}{x_{5} - x_{4}} \times ( {x_{1} - x_{4}} )} + {\frac{( {{vx}_{6} - {vx}_{4}} )}{y_{6} - y_{4}} \times ( {y_{1} - y_{4}} )}}} \\{{vy}_{1} = {{vy}_{4} + {\frac{( {{vy}_{5} - {vy}_{4}} )}{x_{5} - x_{4}} \times ( {x_{1} - x_{4}} )} + {\frac{( {{vy}_{6} - {vy}_{4}} )}{y_{6} - y_{4}} \times ( {y_{1} - y_{4}} )}}}\end{matrix}  & (9)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx}_{2} = {{vx}_{4} + {\frac{( {{vx}_{5} - {vx}_{4}} )}{x_{5} - x_{4}} \times ( {x_{2} - x_{4}} )} + {\frac{( {{vx}_{6} - {vx}_{4}} )}{y_{6} - y_{4}} \times ( {y_{2} - y_{4}} )}}} \\{{vy}_{2} = {{vy}_{4} + {\frac{( {{vy}_{5} - {vy}_{4}} )}{x_{5} - x_{4}} \times ( {x_{2} - x_{4}} )} + {\frac{( {{vy}_{6} - {vy}_{4}} )}{y_{6} - y_{4}} \times ( {y_{2} - y_{4}} )}}}\end{matrix}  & (10)\end{matrix}$

A combination of the motion vector (vx0, vy0) of the top-left sample(x0, y0) of the current block, the motion vector (vx1, vy1) of thetop-right sample (x1, y1) of the current block, and the motion vector(vx2, vy2) of the bottom-left sample (x2, y2) of the current block thatare obtained based on the affine coding block in which A1 is located isthe candidate control point motion vector of the current block.

It should be noted that other motion models, candidate locations, andsearch and traversal orders are also applicable to this application.Details are not described in this embodiment of this application.

It should be noted that methods in which other control points are usedto represent motion models of neighboring and current encoding blocksare also applicable to this application. Details are not describedherein.

(4) Method 1 for predicting constructed control point motion vectors(constructed control point motion vectors)

The method for predicting the constructed control point motion vector iscombining motion vectors of neighboring encoded blocks around a controlpoint of a current block to serve as a control point motion vector of acurrent affine coding block, without considering whether the neighboringencoded blocks are affine coding blocks.

Motion vectors of the top-left sample and the top-right sample of thecurrent block are determined by using motion information of theneighboring encoded blocks around the current encoding block. FIG. 5A isused as an example to describe the method for predicting the constructedcontrol point motion vector. It should be noted that FIG. 5A is merelyan example.

As shown in FIG. 5A, motion vectors of neighboring encoded blocks A2,B2, and B3 of the top-left sample are used as candidate motion vectorsfor a motion vector of the top-left sample of a current block, andmotion vectors of neighboring encoded blocks B1 and B0 of the top-rightsample are used as candidate motion vectors for a motion vector of thetop-right sample of the current block. The candidate motion vectors ofthe top-left sample and the candidate motion vectors of the top-rightsample are combined to constitute a plurality of 2-tuples. Motionvectors of two encoded blocks included in a 2-tuple may be used ascandidate control point motion vectors of the current block, as shown informula (11A):

{v _(A2) ,v _(B1) },{v _(A2) ,v _(B0) },{v _(B2) ,v _(B1) },{v _(B2) ,v_(B0) },{v _(B3) ,v _(B1) },{v _(B3) ,v ^(B0)}  (11A), where

v_(A2) represents a motion vector of A2, v_(B1) represents a motionvector of B1, v_(B0) represents a motion vector of B0, v_(B2) representsa motion vector of B2, and v_(B3) represents a motion vector of B3.

As shown in FIG. 5A, motion vectors of neighboring encoded blocks A2,B2, and B3 of the top-left sample are used as candidate motion vectorsfor a motion vector of the top-left sample of a current block, motionvectors of neighboring encoded blocks B1 and B0 of the top-right sampleare used as candidate motion vectors for a motion vector of thetop-right sample of the current block, and motion vectors of neighboringencoded blocks A0 and A1 of the bottom-left sample are used as candidatemotion vectors for a motion vector of the bottom-left sample of thecurrent block. The candidate motion vectors of the top-left sample, thecandidate motion vectors of the top-right sample, and the candidatemotion vectors of the bottom-left sample are combined to constitute3-tuples. Motion vectors of three encoded blocks included in a 3-tuplemay be used as candidate control point motion vectors of the currentblock, as shown in formula (11B) and formula (11C):

{v _(A2) ,v _(B1) ,v _(A0) },{v _(A2) ,v _(B0) ,v _(A0) },{v _(B2) ,V_(B1) ,v _(A0) },{v _(B2) ,v _(B0) ,v _(A0) },{v _(B3) ,v _(B1) ,v _(A0)},{v _(B3) ,v _(B0) ,v _(A0)}  (11B)

{v _(A2) ,v _(B1) ,v _(A1) },{v _(A2) ,v _(B0) ,v _(A1) },{v _(B2) ,v_(B1) ,v _(A1) },{v _(B2) ,v _(B0) ,v _(A1) },{v _(B3) ,v _(B1) ,v _(A1)},{v _(B3) ,v _(B0) ,v _(A1)}  (11C), where

v_(A2) represents a motion vector of A2, v_(B1) represents a motionvector of B1, v_(B0) represents a motion vector of B0, v_(B2) representsa motion vector of B2, v_(B3) represents a motion vector of B3, v_(A0)represents a motion vector of A0, and V_(A1) represents a motion vectorof A1.

It should be noted that other methods for combining control point motionvectors are also applicable to this application. Details are notdescribed herein.

It should be noted that methods in which other control points are usedto represent motion models of neighboring and current encoding blocksare also applicable to this application. Details are not describedherein.

(5) Method 2 for predicting constructed control point motion vectors(constructed control point motion vectors), as shown in FIG. 5B.

Step 501: Obtain motion information of control points of a currentblock.

For example, in FIG. 5A, CPk (k=1, 2, 3, 4) represents a k^(th) controlpoint. A0, A1, A2, B0, B1, B2, and B3 are spatial neighboring locationsof the current block, and are used to predict CP1, CP2, or CP3. T is atemporal neighboring location of the current block, and is used topredict CP4.

It is assumed that coordinates of CP1, CP2, CP3, and CP4 are (0, 0), (W,0), (H, 0), and (W, H), respectively, where W and H represent the widthand the height of the current block.

Motion information of each control point is obtained in the followingorder:

-   -   (1) For CP1, a check order is B2→A2→B3. If B2 is available,        motion information of B2 is used. Otherwise, A2 and B3 are        checked. If motion information of all the three locations is        unavailable, motion information of CP1 cannot be obtained.    -   (2) For CP2, a check order is B0→B1. If B0 is available, motion        information of B0 is used for CP2. Otherwise, B1 is checked. If        motion information of both the locations is unavailable, motion        information of CP2 cannot be obtained.    -   (3) For CP3, a check order is A0→A1.    -   (4) For CP4, motion information of T is used.

Herein, that X is available mean that a block including an X (X is A0,A1, A2, B0, B1, B2, B3, or T) location has been encoded and an interprediction mode is used. Otherwise, the X location is unavailable.

It should be noted that other methods for obtaining the motioninformation of the control points are also applicable to thisapplication. Details are not described herein.

Step 502: Combine the motion information of the control points, toobtain constructed control point motion information.

Motion information of two control points is combined to constitute a2-tuple, to construct a 4-parameter affine motion model. The two controlpoints may be combined as follows: {CP1, CP4}, {CP2, CP3}, {CP1, CP2},{CP2, CP4}, {CP1, CP3}, or {CP3, CP4}. For example, a 4-parameter affinemotion model constructed by using a 2-tuple that is based on motioninformation (for example, 2 MVs) of the control points CP1 and CP2 maybe denoted as Affine (CP1, CP2).

Motion information of three control points is combined to constitute a3-tuple, to construct a 6-parameter affine motion model. The threecontrol points may be combined as follows: {CP1, CP2, CP4}, {CP1, CP2,CP3}, {CP2, CP3, CP4}, or {CP1, CP3, CP4}. For example, a 6-parameteraffine motion model constructed by using a 3-tuple that is based onmotion information (for example, 3 MVs) of the control points CP1, CP2,and CP3 may be denoted as Affine (CP1, CP2, CP3).

Motion information of four control points is combined to constitute a4-tuple, to construct an 8-parameter bilinear motion model. An8-parameter bilinear model constructed by using a 4-tuple includingmotion information (for example, 4 MVs) of the control points CP1, CP2,CP3, and CP4 is denoted as Bilinear (CP1, CP2, CP3, CP4).

In this embodiment of this application, for ease of description, acombination of motion information of two control points (or two encodedblocks) is referred to as a 2-tuple for short, a combination of motioninformation of three control points (or three encoded blocks) isreferred to as a 3-tuple for short, and a combination of motioninformation of four control points (or four encoded blocks) is referredto as a 4-tuple for short.

These models are traversed in a preset order. If motion information of aspecific control point corresponding to a combined model is unavailable,it is considered that the model is unavailable. Otherwise, a referencepicture index of the model is determined, and a motion vector of thecontrol point is scaled. If motion information of all control pointsobtained after scaling is consistent, the model is invalid. If all ofmotion information of control points controlling the model is available,and the model is valid, the motion information of the control points forconstructing the model is added to a motion information candidate list.

A control point motion vector scaling method is shown in formula (12):

$\begin{matrix}{{{MV}_{s} = {\frac{{CurPoc} - {DesPoc}}{{CurPoc} - {SrcPoc}} \times {MV}}},} & (12)\end{matrix}$

where

CurPoc represents a POC number of a current frame, DesPoc represents aPOC number of a reference frame of a current block, SrcPoc represents aPOC number of a reference frame of a control point, MV s represents amotion vector obtained after scaling, and MV represents a motion vectorof a control point.

It should be noted that a combination of different control points may beconverted into control points in a same location.

For example, a 4-parameter affine motion model obtained by using acombination {CP1, CP4}, {CP2, CP3}, {CP2, CP4}, {CP1, CP3}, or {CP3,CP4} is converted into {CP1, CP2} or {CP1, CP2, CP3}. A conversionmethod is: substituting motion vectors of the control points andcoordinate information of the control points into formula (2), to obtaina model parameter; and then substituting coordinate information of {CP1,CP2} into formula (3), to obtain motion vectors of CP1 and CP2.

More directly, conversion may be performed according to formulas (13) to(21). W represents the width of the current block. H represents theheight of the current block. In formulas (13) to (21), (vx₀, vy₀)represents a motion vector of CP1, (vx₁, vy₁) represents a motion vectorof CP2, (vx₂, vy₂) represents a motion vector of CP3, and (vx₃, vy₃)represents a motion vector of CP4.

{CP1, CP2} may be converted into {CP1, CP2, CP3} by using formula (13).In other words, the motion vector of CP3 in {CP1, CP2, CP3} may bedetermined by using formula (13):

$\begin{matrix}\{ \begin{matrix}{{vx}_{2} = {{{- \frac{{vy}_{1} - {vy}_{0}}{W}}H} + {vx}_{0}}} \\{{vy}_{2} = {{{+ \frac{{vx}_{1} - {vx}_{0}}{W}}H} + {vy}_{0}}}\end{matrix}  & (13)\end{matrix}$

{CP1, CP3} may be converted into {CP1, CP2} or {CP1, CP2, CP3} by usingformula (14):

$\begin{matrix}\{ \begin{matrix}{{vx}_{1} = {{{+ \frac{{vy}_{2} - {vy}_{0}}{H}}W} + {vx}_{0}}} \\{{vy}_{1} = {{{- \frac{{vx}_{2} - {vx}_{0}}{H}}W} + {vy}_{0}}}\end{matrix}  & (14)\end{matrix}$

{CP2, CP3} may be converted into {CP1, CP2} or {CP1, CP2, CP3} by usingformula (15):

$\begin{matrix}\{ \begin{matrix}{{vx}_{0} = {{\frac{{vx}_{2} - {vx}_{1}}{{W*W} + {H*H}}W*W} - {\frac{{vy}_{2} - {vy}_{1}}{{W*W} + {H*H}}H*W} + {vx}_{1}}} \\{{vy}_{0} = {{\frac{{vy}_{2} - {vy}_{1}}{{W*W} + {H*H}}W*W} + {\frac{{vx}_{2} - {vx}_{1}}{{W*W} + {H*H}}H*W} + {vy}_{1}}}\end{matrix}  & (15)\end{matrix}$

{CP1, CP4} may be converted into {CP1, CP2} or {CP1, CP2, CP3} by usingformula (16) or (17):

$\begin{matrix}\{ \begin{matrix}{{vx}_{1} = {{\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}W*W} + {\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}H*W} + {vx}_{0}}} \\{{vy}_{1} = {{\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}W*W} - {\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}H*W} + {vy}_{0}}}\end{matrix}  & (16)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx}_{2} = {{\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}H*H} - {\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}H*W} + {vx}_{0}}} \\{{vy}_{2} = {{\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}W*H} + {\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}H*H} + {vy}_{0}}}\end{matrix}  & (17)\end{matrix}$

{CP2, CP4} may be converted into {CP1, CP2} by using formula (18), and{CP2, CP4} may be converted into {CP1, CP2, CP3} by using formulas (18)and (19):

$\begin{matrix}\{ \begin{matrix}{{vx}_{0} = {{{- \frac{{vy}_{3} - {vy}_{1}}{H}}W} + {vx}_{1}}} \\{{vy}_{0} = {{{+ \frac{{vx}_{3} - {vx}_{1}}{H}}W} + {vy}_{1}}}\end{matrix}  & (18)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx}_{2} = {{{- \frac{{vy}_{3} - {vy}_{1}}{H}}W} + {vx}_{3}}} \\{{vy}_{2} = {{{+ \frac{{vx}_{3} - {vx}_{1}}{H}}W} + {vy}_{3}}}\end{matrix}  & (19)\end{matrix}$

{CP3, CP4} may be converted into {CP1, CP2} by using formula (20), and{CP3, CP4} may be converted into {CP1, CP2, CP3} by using formulas (20)and (21):

$\begin{matrix}\{ \begin{matrix}{{vx}_{0} = {{{+ \frac{{vy}_{3} - {vy}_{2}}{W}}H} + {vx}_{2}}} \\{{vy}_{0} = {{{- \frac{{vx}_{3} - {vx}_{2}}{W}}H} + {vy}_{2}}}\end{matrix}  & (20)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx}_{1} = {{{+ \frac{{vy}_{3} - {vy}_{2}}{W}}H} + {vx}_{3}}} \\{{vy}_{1} = {{{- \frac{{vx}_{3} - {vx}_{2}}{W}}H} + {vy}_{3}}}\end{matrix}  & (21)\end{matrix}$

For example, a 6-parameter affine motion model obtained by using acombination {CP1, CP2, CP4}, {CP2, CP3, CP4}, or {CP1, CP3, CP4} isconverted into {CP1, CP2, CP3} of control points. A conversion methodis: substituting motion vectors of control points and coordinateinformation of the control points into formula (4), to obtain a modelparameter; and then substituting coordinate information of {CP1, CP2,CP3} into formula (5), to obtain motion vectors of CP1, CP2, and CP3.

More directly, conversion may be performed according to formulas (22) to(24). W represents the width of the current block. H represents theheight of the current block. In formulas (13) to (21), (vx₀, vy₀)represents a motion vector of CP1, (vx₁, vy₁) represents a motion vectorof CP2, (vx₂, vy₂) represents a motion vector of CP3, and (vx₃, vy₃)represents a motion vector of CP4.

{CP1, CP2, CP4} may be converted into {CP1, CP2, CP3} according toformula (22):

$\begin{matrix}\{ \begin{matrix}{{vx}_{2} = {{vx}_{3} + {vx}_{0} - {vx}_{1}}} \\{{vy}_{2} = {{vy}_{3} + {vy}_{0} - {vy}_{1}}}\end{matrix}  & (22)\end{matrix}$

{CP2, CP3, CP4} may be converted into {CP1, CP2, CP3} according toformula (23):

$\begin{matrix}\{ \begin{matrix}{{vx}_{0} = {{vx}_{1} + {vx}_{2} - {vx}_{3}}} \\{{vy}_{0} = {{vy}_{1} + {vy}_{2} - {vy}_{3}}}\end{matrix}  & (23)\end{matrix}$

{CP1, CP3, CP4} may be converted into {CP1, CP2, CP3} according toformula (24):

$\begin{matrix}\{ \begin{matrix}{{vx}_{1} = {{vx}_{3} + {vx}_{0} - {vx}_{2}}} \\{{vy}_{1} = {{vy}_{3} + {vy}_{0} - {vy}_{2}}}\end{matrix}  & (24)\end{matrix}$

(6) An affine motion model-based advanced motion vector prediction mode(Affine AMVP mode):

1. Construct a Candidate Motion Vector List

The candidate motion vector list for the affine motion model-based AMVPmode is constructed by using a method for predicting an inheritedcontrol point motion vector and/or a constructed control point motionvector. In this embodiment of this application, the candidate motionvector list for the affine motion model-based AMVP mode may be referredto as a control point motion vector predictor candidate list (controlpoint motion vectors predictor candidate list), and each control pointmotion vector predictor includes motion vectors of two (a 4-parameteraffine motion model) control points or motion vectors of three(6-parameter affine motion model) control points.

Optionally, the control point motion vector predictor candidate list ispruned and sorted according to a specific rule, and may be truncated orpadded to a specific quantity.

2. Determine an Optimal Control Point Motion Vector Predictor

On an encoder side, a motion vector of each motion compensation subunitin a current encoding block is obtained according to formula (3)/(5) byusing each control point motion vector predictor in the control pointmotion vector predictor candidate list. Further, a pixel value in acorresponding location in a reference frame to which a motion vector ofeach motion compensation subunit points is obtained, and is used as apredictor of the pixel value, to perform motion compensation by using anaffine motion model. Average values of differences between originalvalues and predictors of all samples in the current encoding block arecalculated. A control point motion vector predictor corresponding tominimum average values is selected as an optimal control point motionvector predictor, and is used as two/three control point motion vectorpredictors of the current encoding block. An index number representing alocation of the control point motion vector predictor in the controlpoint motion vector predictor candidate list is encoded into a bitstreamand sent to a decoder.

On a decoder side, the index number is parsed, and the control pointmotion vector predictor (control point motion vectors predictor, CPMVP)is determined from the control point motion vector predictor candidatelist based on the index number.

3. Determine Control Point Motion Vectors

On the encoder side, a control point motion vector predictor is used asa search start point for motion search within a specific search range,to obtain control point motion vectors (control point motion vectors,CPMV). Differences (control point motion vector differences, CPMVD)between the control point motion vectors and the control point motionvector predictor are transferred to the decoder side.

On the decoder side, the control point motion vector differences areparsed, and the control point motion vector difference and the controlpoint motion vector predictor are added to obtain the control pointmotion vectors.

(7) Affine Merge Mode (Affine Merge Mode)

A control point motion vector merge candidate list (control point motionvectors merge candidate list) is constructed by using the method forpredicting the inherited control point motion vector and/or theconstructed control point motion vector.

Optionally, the control point motion vector merge candidate list ispruned and sorted according to a specific rule, and may be truncated orpadded to a specific quantity.

On an encoder side, a motion vector of each motion compensation subunit(a sample or a pixel block that has a size of N₁×N₂ and that is obtainedthrough partitioning according to a specific method) in a currentencoding block is obtained according to formula (3)/(5) by using eachcontrol point motion vector in the merge candidate list. Further, apixel value in a location in a reference frame to which a motion vectorof each motion compensation subunit points is obtained, and is used as apredictor of the pixel value, to perform affine motion compensation.Average values of differences between original values and predictors ofall samples in the current encoding block are calculated. A controlpoint motion vector corresponding to minimum average values of thedifferences is selected as selected as two/three control point motionvectors of the current encoding block. An index number representing alocation of the motion vectors of the control points in the candidatelist is encoded into a bitstream and sent to a decoder.

On a decoder side, an index number is parsed, and the control pointmotion vectors (control point motion vectors, CPMV) are determined fromthe control point motion vector merge candidate list based on the indexnumber.

In addition, it should be noted that, in this application, “at leastone” means one or more, and “a plurality of” means two or more than two.The term “and/or” describes an association relationship betweenassociated objects and represents that three relationships may exist.For example, A and/or B may represent the following cases: Only Aexists, both A and B exist, and only B exists, where A and B may be in asingular or plural form. The character “/” generally indicates an “or”relationship between the associated objects. “At least one of thefollowing items (pieces)” or a similar expression thereof indicates anycombination of these items, including a single cases (pieces) or anycombination of a plurality of items (pieces). For example, at least oneof a, b, or c may indicate: a, b, c, a-b, a-c, b-c, or a-b-c, where a,b, and c may be singular or plural.

In this application, when the current block is decoded by using an interprediction mode, an inter prediction mode may be signaled by using asyntax element.

Currently, for a part of syntax structure currently used to parse theinter prediction mode that is used for the current block, refer toTable 1. It should be noted that a syntax element in a syntax structuremay be alternatively represented by another identifier. This is notspecifically limited in this application.

TABLE 1 Descriptor coding_unit(x0,y0,cbWidth,cbHeight) { (descriptor)  ...     merge_flag[x0][y0] ae(v)     if(merge_flag[x0][y0]) {       if(allowAffineMerge)         affine_merge_flag[x0][y0] ae(v)       if(MaxNumMergeCand > 1)         merge_idx[x0][y0] ae(v)     } else {      if(slice_type == B)         inter_pred_idc[x0][y0] ae(v)       if(allowAffineInter) {         affine_inter_flag[x0][y0] ae(v)        if(affine_inter_flag[x0][y0])           affine_type_flag[x0][y0]ae(v)       }       MotionModelIdc[x0][y0] = affine_inter_flag[x0][y0] +      affine_type_flag[x0][y0]       if(inter_pred_idc[x0][y0] !=PRED_L1) {         if(num_ref_idx_l0_active_minus1 > 0)          ref_idx_l0[x0][y0] ae(v)         mvd_coding(x0, y0, 0, 0)        if(MotionModelIdc[x0][y0] > 0) {           mvd_coding(x0, y0,0, 1)           if(MotionModelIdc[x0][y0] > 1)            mvd_coding(x0, y0, 0, 2)         }        mvp_l0_flag[x0][y0] ae(v)       }      if(inter_pred_idc[x0][y0] != PRED_L0) {        if(num_ref_idx_l1_active_minus1 > 0)          ref_idx_l1[x0][y0] ae(v)         mvd_coding(x0, y0, 1, 0)        if(MotionModelIdc[x0][y0] > 0) {           mvd_coding(x0, y0,1, 1)           if(MotionModelIdc[x0][y0] > 1)            mvd_coding(x0, y0, 1, 2)         }        mvp_l1_flag[x0][y0] ae(v)       }     }   ...   }

The syntax element merge_flag[x0][y0] may be used to indicate whether amerge mode is used for a current block. For example, whenmerge_flag[x0][y0]=1, it indicates that the merge mode is used for thecurrent block; or when merge_flag[x0][y0]=0, it indicates that the mergemode is not used for the current block. x0 and y0 represent coordinatesof the current block relative to a video picture.

The variable allowAffineMerge may be used to indicate whether acondition for allowing an affine motion model-based merge mode for thecurrent block is satisfied. For example, when allowAffineMerge=0, itindicates that the condition for allowing the affine motion model—basedmerge mode is not satisfied; or when allowAffineMerge=1, it indicatesthat the condition for the affine motion model-based merge mode issatisfied. The condition for allowing the affine motion model-basedmerge mode may be that both the width and the height of the currentblock are greater than or equal to 8. cbWidth represents the width ofthe current block, and cbHeight represents the height of the currentblock. That is, when cbWidth<8 or cbHeight<8, allowAffineMerge=0; orwhen cbWidth≥8 and cbHeight≥8, allowAffineMerge=1.

The variable allowAffineInter may be used to indicate whether acondition for allowing an affine motion model-based AMVP mode for thecurrent block is satisfied. For example, when allowAffineInter=0, itindicates that the condition for allowing the affine motion model-basedAMVP mode is not satisfied; or when allowAffineInter=1, it indicatesthat the condition for allowing the affine motion model-based AMVP modeis satisfied. The condition for allowing the affine motion model-basedAMVP mode may be that both the width and the height of the current blockare greater than or equal to 16. In other words, when cbWidth<16 orcbHeight<16, allowAffineInter=0; or when cbWidth≥16 and cbHeight≥16,allowAffineInter=1.

The syntax element affine_merge_flag[x0][y0] may be used to indicatewhether the affine motion model-based merge mode is used for the currentblock when the slice including the current block is a P slice or a Bslice. For example, when affine_merge_flag[x0][y0]=1, it indicates thatthe affine motion model-based merge mode is used for the current block;or when affine_merge_flag[x0][y0]=0, it indicates that the affine motionmodel-based merge mode is not used for the current block, and atranslational motion model-based merge mode may be used.

The syntax element affine_inter_flag[x0][y0] may be used to indicatewhether the affine motion model-based AMVP mode is used for the currentblock when the slice including the current block is a P slice or a Bslice. For example, when affine_inter_flag[x0][y0]=1, it indicates thatthe affine motion model-based AMVP mode is used for the current block;or when affine_inter_flag[x0][y0]=0, it indicates that the affine motionmodel-based AMVP mode is not used for the current block, and atranslational motion model-based AMVP mode may be used.

The syntax element affine_type_flag[x0][y0] may be used to indicatewhether a 6-parameter affine motion model-based motion compensation isused for the current block when the slice including the current block isa P slice or a B slice. When affine_type_flag[x0][y0]=0, it indicatesthat the 6-parameter affine motion model-based motion compensation isnot used for the current block, and only a 4-parameter affine motionmodel-based motion compensation may be used for the current block; orwhen affine_type_flag[x0][y0]=1, it indicates that the 6-parameteraffine motion model-based motion compensation is used for the currentblock.

As shown in Table 2, when MotionModelIdc[x0][y0]=1, it indicates thatthe 4-parameter affine motion model is used; whenMotionModelIdc[x0][y0]=2, it indicates that the 6-parameter affinemotion model is used; or when MotionModelIdc[x0][y0]=0, it indicatesthat a translational motion model is used.

TABLE 2 Motion model for motion compensation MotionModelIdc[x0][y0](motion model for motion compensation) 0 Translational motion(translational motion) 1 4-parameter affine motion (4-parameter affinemotion) 2 6-parameter affine motion (6-parameter affine motion)

The variable MaxNumMergeCand is used to represent a maximum list length,and indicates a maximum number of candidates of a constructed candidatemotion vector list. inter_pred_idc[x0][y0] is used to indicate aprediction direction. PRED_L1 is used to indicate backward prediction.num_ref_idx_10_active_minus1 indicates a quantity of reference frames ina forward reference frame list(list 0), and ref_idx_10[x0][y0] indicatesa forward (list 0) reference picture index for the current block.mvd_coding(x0, y0, 0, 0) indicates a first motion vector difference.mvp_10_flag[x0][y0] indicates an MVP candidate index of a forward MVPcandidate list (list 0). PRED_L0 indicates forward prediction.num_ref_idx_11_active_minus1 indicates a quantity of reference frames ina backward reference frame list (list 1). ref_idx_11[x0][y0] indicates abackward (list 1) reference picture index for the current block, andmvp_11_flag[x0][y0] indicates an MVP candidate index of a backward MVPcandidate list (list 1).

In Table 1, ae(v) represents a syntax element encoded by usingcontext-based adaptive binary arithmetic coding (context-based adaptivebinary arithmetic coding, CABAC).

The following describes in detail an inter prediction process. Refer toFIG. 6A.

Step 601: Parse a bitstream based on a syntax structure shown in Table1, to determine an inter prediction mode of a current block.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based AMVP mode, step 602 a is performed.

That is, when merge_flag=0 and affine_inter_flag=1, it indicates thatthe inter prediction mode of the current block is the affine motionmodel-based AMVP mode.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based merge (merge) mode, step 602 b isperformed.

That is, when merge_flag=1 and affine_merge_flag=1 in the syntaxelements, it indicates that the inter prediction mode of the currentblock is the affine motion model-based merge mode.

Step 602 a: Construct a candidate motion vector list corresponding tothe affine motion model-based AMVP mode, and perform step 603 a.

A candidate control point motion vector of the current block is derivedby using a method for predicting an inherited control point motionvector and/or a constructed control point motion vector, and is added tothe candidate motion vector list.

The candidate motion vector list may include a 2-tuple list (a currentencoding block is a 4-parameter affine motion model) or a 3-tuple list.The 2-tuple list includes one or more 2-tuples used to construct the4-parameter affine motion model. The 3-tuple list includes one or more3-tuples used to construct a 6-parameter affine motion model.

Optionally, the candidate motion vector 2-tuple/3-tuple list is prunedand sorted according to a specific rule, and may be truncated or paddedto a specific quantity.

A1: Descriptions are provided for a procedure of constructing thecandidate motion vector list by using the method for predicting theinherited control point motion vector.

FIG. 4 is used as an example. For example, blocks in neighboringlocations around the current block are traversed in an orderA1→B1→B0→A0→B2 in FIG. 4 , to find affine coding blocks in which theblocks in the neighboring locations are located and obtain control pointmotion information of the affine coding blocks. Further, a motion modelis constructed by using the control point motion information of theaffine coding blocks, and candidate control point motion information ofthe current block is derived. For details, refer to related descriptionsof the method for predicting the inherited control point motion vectorin (3). Details are not described herein.

For example, an affine motion model used for the current block is a4-parameter affine motion model (that is, MotionModelIdc=1). If aneighboring affine coding block is a 4-parameter affine motion model,motion vectors of two control points of the affine coding block areobtained: a motion vector (vx4, vy4) of the top-left control point (x4,y4) and a motion vector (vx5, vy5) of the top-right control point (x5,y5). The affine coding block is an affine coding block predicted in anencoding phase by using the affine motion model.

Motion vectors of the top-left control point and the top-right controlpoint of the current block are derived by using the 4-parameter affinemotion model including the two control points of the neighboring affinecoding block and according to formulas (6) and (7) corresponding to the4-parameter affine motion model, respectively.

If a 6-parameter affine motion model is used for the neighboring affinecoding block, motion vectors of three control points of the neighboringaffine coding block are obtained, for example, a motion vector (vx4,vy4) of the top-left control point (x4, y4), a motion vector (vx5, vy5)of the top-right control point (x5, y5), and a motion vector (vx6, vy6)of the bottom-left control point (x6, y6) in FIG. 4 .

Motion vectors of the top-left control point and the top-right controlpoint of the current block are derived by using the 6-parameter affinemotion model including the three control points of the neighboringaffine coding block and according to formulas (8) and (9) correspondingto the 6-parameter affine motion model, respectively.

For example, an affine motion model for the current decoding block is a6-parameter affine motion model (that is, MotionModelIdc=2).

If an affine motion model used for a neighboring affine coding block isa 6-parameter affine motion model, motion vectors of three controlpoints of the neighboring affine coding block are obtained, for example,a motion vector (vx4, vy4) of the top-left control point (x4, y4), amotion vector (vx5, vy5) of the top-right control point (x5, y5), and amotion vector (vx6, vy6) of the bottom-left control point (x6, y6) inFIG. 4 .

Motion vectors of the top-left control point, the top-right controlpoint, and the bottom-left control point of the current block arederived by using the 6-parameter affine motion model including the threecontrol points of the neighboring affine coding block and according toformulas (8), (9), and (10) corresponding to the 6-parameter affinemotion model, respectively.

If an affine motion model used for a neighboring affine coding block isa 4-parameter affine motion model, motion vectors of two control pointsof the affine coding block are obtained: a motion vector (vx4, vy4) ofthe top-left control point (x4, y4) and a motion vector (vx5, vy5) ofthe top-right control point (x5, y5).

Motion vectors of the top-left control point, the top-right controlpoint, and the bottom-left control point of the current block arederived by using the 4-parameter affine motion model including the twocontrol points of the neighboring affine coding block and according toformulas (6) and (7) corresponding to the 4-parameter affine motionmodel, respectively.

It should be noted that other motion models, candidate locations, andsearch orders are also applicable to this application. Details are notdescribed herein. It should be noted that methods in which other controlpoints are used to represent motion models of neighboring and currentencoding blocks are also applicable to this application. Details are notdescribed herein.

A2: Descriptions are provided for a procedure of constructing thecandidate motion vector list by using the method for predicting theconstructed control motion vector.

For example, an affine motion model used for a current decoding block isa 4-parameter affine motion model (that is, MotionModelIdc is 1). Inthis case, motion vectors of the top-left sample and the top-rightsample of the current encoding block are determined by using motioninformation of a neighboring encoded block around the current encodingblock. Specifically, the candidate motion vector list may be constructedin a manner 1 or a manner 2 of predicting the constructed control pointmotion vector. For a specific manner, refer to the descriptions in (4)and (5). Details are not described herein.

For example, if an affine motion model used for a current decoding blockis a 6-parameter affine motion model (that is, MotionModelIdc is 2),motion vectors of the top-left sample, the top-right sample, and thebottom-left sample of the current encoding block are determined by usingmotion information of a neighboring encoded block around the currentencoding block. Specifically, the candidate motion vector list may beconstructed in a manner 1 or a manner 2 of predicting the constructedcontrol point motion vector. For a specific manner, refer to thedescriptions in (4) and (5). Details are not described herein.

It should be noted that other combinations of control point motioninformation are also applicable to this application. Details are notdescribed herein.

Step 603 a: Parse the bitstream, to determine an optimal control pointmotion vector predictor, and perform step 604 a.

B1: If the affine motion model used for the current decoding block isthe 4-parameter affine motion model (MotionModelIdc is 1), obtain anindex number through parsing, and determine an optimal motion vectorpredictor of two control points from the candidate motion vector listbased on the index number.

For example, the index number is mvp_10_flag or mvp_11_flag.

B2: If the affine motion model used for the current decoding block isthe 6-parameter affine motion model (MotionModelIdc is 2), obtain anindex number through parsing, and determine an optimal motion vectorpredictor of three control points from the candidate motion vector listbased on the index number.

Step 604 a: Parse the bitstream to determine control point motionvectors.

C1: When the affine motion model used for the current decoding block isthe 4-parameter affine motion model (MotionModelIdc is 1), decode thebitstream to obtain motion vector differences of two control points ofthe current block, and obtain control point motion vectors based on themotion vector differences and a motion vector predictor of the controlpoints. Forward prediction is used as an example. Motion vectordifferences of two control points are mvd_coding(x0, y0, 0, 0) andmvd_coding(x0, y0, 0, 1).

For example, motion vector differences of the top-left control point andthe top-right control point are obtained by decoding the bitstream, andare added to motion vector predictors respectively, to obtain motionvectors of the top-left control point and the top-right control point ofthe current block.

C2: When the affine motion model for the current decoding block is the6-parameter affine motion model (that is, MotionModelIdc is 2),

-   -   decode the bitstream to obtain motion vector differences of        three control points of the current block, and obtain control        point motion vectors based on the motion vector differences and        a motion vector predictor of the control points. Forward        prediction is used as an example. Motion vector differences of        three control points are mvd_coding(x0, y0, 0, 0),        mvd_coding(x0, y0, 0, 1), and mvd_coding(x0, y0, 0, 2).

For example, motion vector differences of the top-left control point,the top-right control point, and the bottom-left control point areobtained by decoding the bitstream, and are added to motion vectorpredictors respectively, to obtain motion vectors of the top-leftcontrol point, the top-right control point, and the bottom-left controlpoint of the current block.

Step 602 b: Construct a motion information candidate list for the affinemotion model—based merge mode.

Specifically, the motion information candidate list for the affinemotion model-based merge mode may be constructed by using the method forpredicting the inherited control point motion vector and/or theconstructed control point motion vector.

Optionally, the motion information candidate list is pruned and sortedaccording to a specific rule, and may be truncated or padded to aspecific quantity.

D1: Descriptions are provided for a procedure of constructing thecandidate motion vector list by using the method for predicting theinherited control motion vector.

The candidate control point motion information of the current block isderived by using the method for predicting the inherited control pointmotion vector, and added to the motion information candidate list.

Blocks in neighboring locations around the current block are traversedin the order of A1, B1, B0, A0, and B2 in FIG. 5A, to find affine codingblocks of the neighboring locations, and obtain control point motioninformation of the affine coding blocks. Further, candidate controlpoint motion information of the current block is further derived byusing a motion model constructed from the control point motioninformation of the affine coding blocks.

If the candidate motion vector list is empty at this time, the candidatecontrol point motion information is added to the candidate list.Otherwise, motion information in the candidate motion vector list issequentially traversed to check whether motion information that is thesame as the candidate control point motion information exists in thecandidate motion vector list. If no motion information that is the sameas the candidate control point motion information exists in thecandidate motion vector list, the candidate control point motioninformation is added to the candidate motion vector list.

To determine whether two pieces of candidate motion information are thesame, it is necessary to sequentially determine whether a forwardreference frame, a backward reference frame, horizontal and verticalcomponents of each forward motion vector, and horizontal and verticalcomponents of each backward motion vector in one piece of candidatemotion information are the same as those in the other piece of candidatemotion information. The two pieces of candidate motion information areconsidered as different candidate motion information only when all ofthe foregoing elements are different.

If a quantity of pieces of motion information in the candidate motionvector list reaches a maximum list length MaxNumMrgCand (MaxNumMrgCandis a positive integer such as 1, 2, 3, 4, or 5, 5 is used as an examplefor description in the following, and details are not described herein),construction of the candidate list is completed. Otherwise, blocks innext neighboring locations are traversed.

D2: Derive the candidate control point motion information of the currentblock by using the method for predicting the constructed control pointmotion vector, and add the candidate control point motion information tothe motion information candidate list, as shown in FIG. 6B.

Step 601 c: Obtain motion information of control points of the currentblock. Refer to step 501 in the method 2 for predicting the constructedcontrol point motion vector in (5). Details are not described hereinagain.

Step 602 c: Combine the motion information of the control points, toobtain constructed control point motion information. Refer to step 501in FIG. 5B. Details are not described herein again.

Step 603 c: Add the constructed control point motion information to thecandidate motion vector list.

If a length of the candidate list is less than a maximum list lengthMaxNumMrgCand at this time, these combinations are traversed in a presetorder, to obtain a valid combination as candidate control point motioninformation. If the candidate motion vector list is empty at this time,the candidate control point motion information is added to the candidatemotion vector list. Otherwise, motion information in the candidatemotion vector list is sequentially traversed, to check whether motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list. If no motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list, the candidatecontrol point motion information is added to the candidate motion vectorlist.

For example, a preset order is as follows: Affine (CP1, CP2, CP3)→Affine(CP1, CP2, CP4)→Affine (CP1, CP3, CP4)→Affine (CP2, CP3, CP4)→Affine(CP1, CP2)→Affine (CP1, CP3)→Affine (CP2, CP3)→Affine (CP1, CP4)→Affine(CP2, CP4)→Affine (CP3, CP4). There are a total of 10 combinations.

If control point motion information corresponding to a combination isunavailable, it is considered that the combination is unavailable. If acombination is available, a reference picture index of the combinationis determined (in a case of two control points, a minimum referencepicture index is selected as the reference picture index of thecombination; in a case of more than two control points, a referencepicture index that appears most frequently is selected, and a minimumreference picture index is selected as the reference picture index ofthe combination if quantities of times a plurality of reference pictureindexes appear are the same), and control point motion vectors arescaled. If motion information of all control points obtained afterscaling is consistent, the combination is invalid.

Optionally, in this embodiment of this application, the candidate motionvector list may be further padded. For example, after the foregoingtraversal process, if the length of the candidate motion vector list isless than the maximum list length MaxNumMrgCand, the candidate motionvector list may be padded, until the length of the list is equal toMaxNumMrgCand.

The padding may be performed by filling with a zero motion vector, or bycombining or weighted averaging existing candidate motion information inthe existing list. It should be noted that other methods for padding thecandidate motion vector list are also applicable to this application.Details are not described herein.

Step 603 b: Parse the bitstream to determine optimal control pointmotion information.

The index number is parsed, and the optimal control point motioninformation is determined from the candidate motion vector list based onthe index number.

Step 604 b: Obtain a motion vector of each sub-block of the currentblock based on the optimal control point motion information and anaffine motion model used for the current decoding block.

For each sub-block (a sub-block may also be equivalent to a motioncompensation unit, and the width and the height of the sub-block areless than the width and the height of the current block) of the currentaffine coding block, motion information of a sample in a preset locationin a motion compensation unit may be used to represent motioninformation of all samples in the motion compensation unit. It isassumed that a size of the motion compensation unit is M×N; in thiscase, the sample in the preset location may be the center sample (M/2,N/2), the top-left sample (0, 0), the top-right sample (M−1, 0), or asample in another location of the motion compensation unit. Thefollowing provides descriptions by using the center pixel of the motioncompensation unit as an example. Refer to FIG. 6C. In FIG. 6C, VOrepresents a motion vector of the top-left control point, and V1represents a motion vector of the top-right control point. Each smallsquare box represents one motion compensation unit.

Coordinates of the center sample of the motion compensation unitrelative to the top-left sample of the current affine coding block arecalculated by using formula (25), where i is an i^(th) motioncompensation unit in a horizontal direction (from left to right), j is aj^(th) motion compensation unit in a vertical direction (from top tobottom), and (x_((i,j)), y_((i,j))) represents coordinates of the centersample of an (i, j)^(th) motion compensation unit relative to thetop-left sample of the current affine coding block.

If an affine motion model used for the current affine coding block is a6-parameter affine motion model, (x_((i,j)), y_((i,j))) are substitutedinto formula (26) corresponding to the 6-parameter affine motion model,to obtain a motion vector of the center sample of each motioncompensation unit, and the motion vector of the center sample of eachmotion compensation unit is used as a motion vector (vx_((i,j)),vy_((i,j))) of all samples of the motion compensation unit.

If an affine motion model used for the current affine coding block is a4-parameter affine motion model, (x_((i,j)), y_((i,j))) are substitutedinto formula (27) corresponding to the 4-parameter affine motion model,to obtain a motion vector of the center sample of each motioncompensation unit, and the motion vector of the center sample of eachmotion compensation unit is used as a motion vector (vx_((i,j)),vy_((i,j))) of all samples of the motion compensation unit.

$\begin{matrix}\{ \begin{matrix}{{x_{({i,j})} = {{M \times i} + \frac{M}{2}}},{i = 0},{1..}} \\{{y_{({i,j})} = {{N \times j} + \frac{N}{2}}},{j = 0},{1..}}\end{matrix}  & (25)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} + {\frac{{vx}_{2} - {vy}_{0}}{H}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vy}_{2} - {vx}_{0}}{H}y} + {vy}_{0}}}\end{matrix}  & (26)\end{matrix}$ $\begin{matrix}\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} - {\frac{{vy}_{1} - {vy}_{0}}{W}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vx}_{1} - {vx}_{0}}{W}y} + {vy}_{0}}}\end{matrix}  & (27)\end{matrix}$

Step 605 b: Perform motion compensation for each sub-block based on thedetermined motion vector of the sub-block, to obtain a predicted pixelvalue of the sub-block.

In a conventional technology, both parameter information of the4-parameter affine motion model and parameter information of the6-parameter affine motion model, for example, affine_merge_flag,affine_inter_flag, and affine_type_flag in Table 1, need to betransmitted to a decoder side via the bitstream. If the current videopicture or slice has no affine transformation features, transmission ofthe parameter information increases a quantity of bits in the bitstream.In addition, the parameter information indicating whether an affinemotion model is used for each coding block needs to be parsed on thedecoder side. Consequently, load of a decoder may be increased, aprocessing speed may be reduced, and a processing time may be increased.

Based on this, the embodiments of this application provide a videopicture prediction method and apparatus, to resolve a problem in aconventional technology that a quantity of bits in a bitstream isincreased. The method and the apparatus are based on a same inventiveconcept. Because a problem-resolving principle of the method is similarto that of the apparatus, mutual reference may be made toimplementations of the apparatus and the method. No repeateddescriptions are provided.

To resolve the foregoing problem, the embodiments of this applicationprovide, but not limited to, the following several possibleimplementations.

In a first possible implementation, for example, some video pictures mayhave some affine features, while some video pictures may have no affinefeatures. In this case, an identifier may be added to a bitstream toindicate whether an affine motion model-based inter prediction mode isenabled for the video picture.

In a second possible implementation, for example, not all slices in avideo picture have affine features, an identifier may be added to abitstream to indicate whether an affine motion model-based interprediction mode is enabled for the slice.

In a third possible implementation, for example, some video pictureshave no affine features, and not all slices of some video pictures haveaffine features. In this case, two types of identifiers may be added tothe bitstream. A first type of identifier is used to indicate whether anaffine motion model-based inter prediction mode is enabled for a videopicture, and a second type of identifier is used to indicate whether theaffine motion model-based inter prediction mode is enabled for a slicein the video picture.

For ease of subsequent description, the identifier used to indicatewhether the affine motion model-based inter prediction mode is enabledfor the video picture is referred to as an identifier 1, and theidentifier used to indicate whether the affine motion model-based interprediction mode is enabled for the slice included in the video pictureis referred to as an identifier 2.

In the foregoing three possible implementations, for a picture blockincluded in a video picture or a slice for which an affine motion modeldoes not need to be used, a parameter, related to the affine motionmodel, of the picture block may not need to be transmitted, for example,affine_merge_flag, affine_inter_flag, or affine_type_flag in Table 1. Ona decoder side, during decoding of the picture block, the parameterrelated to the affine motion model does not need to be parsed. This canreduce load of a decoder, increase a processing speed, and decrease aprocessing time.

The following describes in detail the foregoing several possibleimplementations provided in this application from a perspective of adecoder side with reference to the accompanying drawings. Specifically,the possible implementations may be performed by a video decoder 30, ormay be performed by a motion compensation module in a video decoder, ormay be performed by a processor.

Refer to FIG. 7 . A first possible implementation is described.

Step 701: Parse a bitstream to obtain an identifier 1.

The identifier 1 is used to indicate whether a candidate motion modelfor inter prediction of a video picture including a to-be-processedblock includes an affine motion model. In other words, the identifier 1is used to indicate whether the affine motion model-based motioncompensation is enabled for the video picture including theto-be-processed block.

For example, the identifier 1 may be configured in an SPS of thebitstream. Based on this, the parsing a bitstream to obtain anidentifier 1 may be implemented in the following manner: parsing the SPSof the bitstream to obtain the identifier 1.

Step 702: When the identifier 1 indicates that the candidate motionmodel for inter prediction of the video picture including theto-be-processed block includes an affine motion model, and theto-be-processed block meets a preset condition for inter predictionusing the affine motion model, parse the bitstream to obtain anidentifier 12.

Optionally, the preset condition may include at least one of thefollowing cases:

The width of the to-be-processed block is greater than or equal to afirst preset threshold; and

-   -   the height of the to-be-processed block is greater than or equal        to a second preset threshold.

The first preset threshold may be equal to the second preset threshold.For example, when an inter prediction mode is a merge mode, the presetcondition may be that the width of the to-be-processed block is greaterthan or equal to 8, and that the height of the to-be-processed block isgreater than or equal to 8. When an inter prediction mode is an AMVPmode, the preset condition may be that the width of the to-be-processedblock is greater than or equal to 16, and that the height of theto-be-processed block is greater than or equal to 16.

For example, when the inter prediction mode is the merge mode, whetherthe to-be-processed block meets the preset condition for interprediction using the affine motion model may be represented by avariable allowAffineMerge. For example, when the inter prediction modeis an AMVP mode, whether the to-be-processed block meets the presetcondition for inter prediction using the affine motion model may berepresented by a variable allowAffineInter. For related descriptions ofallowAffineMerge and allowAffineInter, refer to Table 1. Details are notdescribed herein again.

For example, when the identifier 1 indicates that the candidate motionmodel for inter prediction of the picture block in the video pictureincluding the to-be-processed block does not include an affine motionmodel, parameter information related to the affine motion model does notneed to be parsed when inter prediction is performed on the pictureblock of the video picture. For example, the bitstream does not need tobe parsed to obtain the identifier 12.

For example, when the identifier 1 is a value A, it indicates that thecandidate motion model for inter prediction of the picture block in thevideo picture including the to-be-processed block includes an affinemotion model, or when the identifier 1 is a value B, it indicates thatthe candidate motion model for inter prediction of the picture block inthe video picture including the to-be-processed block does not includean affine motion model. For example, when the identifier 1 is 1, itindicates that the candidate motion model for inter prediction of thepicture block in the video picture including the to-be-processed blockincludes an affine motion model, or when the identifier 1 is 0, itindicates that the candidate motion model for inter prediction of thepicture block in the video picture including the to-be-processed blockdoes not include an affine motion model.

Step 703: Determine, based on the identifier 12, a prediction mode forinter prediction of the to-be-processed block, where the prediction modeincludes an affine motion model-based merge mode, an affine motionmodel-based AMVP mode, and a non-affine motion model-based predictionmode.

For example, the identifier 1 may be represented by a syntax elementsps_affine_enabled_flag. sps_affine_enabled_flag specifies whetheraffine model based motion compensation is enabled for inter prediction(sps_affine_enabled_flag specifies whether affine model based motioncompensation can be used for inter prediction). For example,sps_affine_enabled_flag is equal to 0, the syntax elements shall beconstrained such that no affine model based motion compensation is usedin the CVS, and affine_merge_flag, affine_inter_flag andaffine_type_flag are not presented in picture block level syntax of theCVS. sps_affine_enabled_flag is equal to 1, affine model based motioncompensation may be used in the CVS. (If sps_affine_enabled_flag isequal to 0, the syntax elements shall be constrained such that no affinemodel based motion compensation is used in the CVS, andaffine_merge_flag, affine_inter_flag and affine_type_flag are notpresented in coding unit level syntax of the CVS. Otherwise(sps_affine_enabled_flag is equal to 1), affine model based motioncompensation may be used in the CVS.)

For example, when the inter prediction mode is the AMVP mode, theidentifier 12 may be represented by a syntax element affine_inter_flag;or when the inter prediction mode is the merge mode, the identifier 12may be represented by a syntax element affine_merge_flag. For relateddescriptions of the affine_inter_flag and the affine_merge_flag, referto the descriptions of Table 1. Details are not described herein again.

In the first possible implementation, in a possible example, anidentifier 13 may be further configured in the bitstream. The identifier13 may be configured in a sequence parameter set of the bitstream. Ifaffine motion model-based merge mode is used for inter prediction of theto-be-processed block, when the identifier 1 obtained by parsing thebitstream indicates that the candidate motion model for inter predictionof the picture block in the video picture including the to-be-processedblock includes the affine motion model, the bitstream is parsed toobtain the identifier 13. When the identifier 13 is a first value, theaffine motion model includes only a 4-parameter affine model; or whenthe identifier 13 is a second value, the affine motion model includes a4-parameter affine model and a 6-parameter affine model. The first valueis different from the second value. For example, the first value is 1,and the second value is 0; or the first value is 0, and the second valueis 1.

For example, the identifier 13 may be represented bysps_affine_type_flag. sps_affine_type_flag specifies whether 6-parameteraffine model based motion compensation is enabled for inter prediction.For example, sps_affine_type_flag is equal to 0, the syntax elementsshall be constrained such that no 6-parameter affine model based motioncompensation is used in the CVS, and affine_type_flag is not presentedin picture block level syntax in the CVS. (sps_affine_type_flagspecifies whether 6-parameter affine model based motion compensation canbe used for inter prediction. If sps_affine_type_flag is equal to 0, thesyntax elements shall be constrained such that no 6-parameter affinemodel based motion compensation is used in the CVS, and affine_type_flagis not presented in cu level syntax in the CVS. Otherwise(sps_affine_type_flag is equal to 1), 6-parameter affine model basedmotion compensation may be used in the CVS. When not present, the valueof sps_affine_type_flag is inferred to be equal to 0.)

In the first possible implementation, in a possible example, when theidentifier 12 indicates that the affine motion model-based AMVP mode isused for inter prediction of the to-be-processed block, and theidentifier 13 is the second value, the bitstream needs to be parsed toobtain an identifier 14. When the identifier 14 is a third value, theaffine motion model is the 6-parameter affine motion model, or when theidentifier 14 is a fourth value, the affine motion model is the4-parameter affine motion model. The third value is different from thefourth value. For example, the third value is 1, and the fourth value is0; or the third value is 0, and the fourth value is 1.

For example, the identifier 14 may be represented by affine_type_flag.affine_type_flag is used to indicate whether 6-parameter affine motionmodel-based motion compensation can be used for inter prediction of thepicture block. For example, when affine_type_flag=0, it indicates thatno 6-parameter affine motion model-based motion compensation can be usedfor inter prediction of the picture block.

For example, for syntax structures for parsing the identifier 1 and theidentifier 13, refer to Table 3. u(1) represents reading one moreconsecutive bit, and is interpreted as an unsigned integer.

TABLE 3 seq_parameter_set_rbsp( ) { Descriptor ...  sps_affine_enabled_flag u(1)   if(sps_affine_enabled_flag)    sps_affine_type_flag u(1) ... ... }

For example, for a part of syntax structure for parsing the interprediction mode used for the current picture block, refer to Table 4.

TABLE 4 coding_unit(x0, y0, cbWidth, cbHeight) { ...  merge_flag[x0][y0] ae(v)   if(merge_flag[x0][y0]) {   if(sps_affine_enable_flag && allowAffineMerge)        affine_merge_flag[x0][y0] ae(v) ...   } else {   ...  if(sps_affine_enable_flag && allowAffineInter){        affine_inter_flag[x0][y0] ae(v)     if(sps_affine_type_flag &&affine_inter_flag[x0][y0])         affine_type_flag[x0][y0] ae(v)     }... } ... }

In the first possible implementation, in a possible example, if thebitstream is parsed to obtain the identifier 1 and the identifier 13,when the identifier 12 indicates that affine motion model-based mergemode is used for inter prediction of the to-be-processed block, and theidentifier 13 is the second value, a first candidate motion vector listis constructed. The first candidate motion vector list includes a firstelement, and the first element includes motion information of threecontrol points for constructing the 6-parameter affine motion model. Forexample, the first element includes one or more 3-tuples.

Optionally, the first candidate motion vector list may further include asecond element. The second element includes only motion information oftwo control points for constructing the 4-parameter affine motion model.For example, the second element includes one or more 2-tuples. The firstcandidate motion vector list may further include a third element, andthe third element includes motion information of a non-affine motionmodel.

In another possible example, when the identifier 12 indicates thataffine motion model—based merge mode is used for inter prediction of theto-be-processed block, and the identifier 13 is the first value, asecond candidate motion vector list is constructed. The second candidatemotion vector list includes a second element, and the second elementincludes only motion information of two control points for constructingthe 4-parameter affine motion model. The second candidate motion vectorlist does not include a first element. The second candidate motionvector list may further include a third element, and the third elementincludes motion information of a non-affine motion model. Both the firstcandidate motion vector list and the second candidate motion vector listare candidate motion vector lists for the affine motion model-basedmerge mode.

In the first possible implementation, in a possible example, if thebitstream is parsed to obtain the identifier 1 and the identifier 13,when the identifier 12 indicates that the affine motion model-based AMVPmode is used for inter prediction of the to-be-processed block, and theidentifier 13 is the second value, the bitstream is parsed to obtain anidentifier 14; and when the identifier 14 is a third value, the affinemotion model is the 6-parameter affine motion model, or when theidentifier 14 is a fourth value, the affine motion model is the4-parameter affine motion model. The third value is different from thefourth value. For example, the third value is 1, and the fourth value is0; or the third value is 0, and the fourth value is 1.

Optionally, the identifier 14 may be represented by a syntax elementaffine_type_flag. For affine_type_flag, refer to related descriptions inTable 1. Details are not described herein again.

The following uses the syntax structures in Table 3 and Table 4 as anexample to describe in detail the inter prediction procedure performedin the first possible manner, as shown in FIG. 8 .

Step 801: Parse a bitstream based on the syntax structures shown inTable 3 and Table 4, to determine an inter prediction mode of a currentblock.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based AMVP mode, step 802 a is performed.

That is, if sps_affine_enabled_flag=1, merge_flag=0, andaffine_inter_flag=1 in the syntax elements, it indicates that the interprediction mode of the current block is the affine motion model-basedAMVP mode.

For example, if sps_affine_enabled_flag=1, merge_flag=0,affine_inter_flag=1, and sps_affine_type_flag=1 in the syntax elements,the bitstream needs to be parsed to obtain affine_type_flag. Ifaffine_type_flag parsed is equal to 1, it indicates that the interprediction mode of the current block is a 6-parameter affine motionmodel-based AMVP mode; or if affine_type_flag obtained through parsingis equal to 0, it indicates that the inter prediction mode of thecurrent block is a 4-parameter affine motion model-based AMVP mode.

For example, if sps_affine_enabled_flag=1, merge_flag=0,affine_inter_flag=1, and sps_affine_type_flag=0 in the syntax elements,it indicates that the inter prediction mode of the current block is a4-parameter affine motion model-based AMVP mode. In this case,affine_type_flag does not need to be parsed.

For example, if sps_affine_enabled_flag=0, and merge_flag=0 in thesyntax elements, it indicates that the inter prediction mode of thecurrent block is a translational motion model-based AMVP mode. In thiscase, affine_merge_flag, affine_inter_flag, and affine_type_flag may notbe included in the bitstream, and do not need to be obtained by parsingthe bitstream.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based merge (merge) mode, step 802 b isperformed.

That is, sps_affine_enabled_flag=1, merge_flag=1, andaffine_merge_flag=1 in the syntax elements, it indicates that the interprediction mode of the current block is the affine motion model-basedmerge mode.

For example, if sps_affine_enabled_flag=0, and merge_flag=1 in thesyntax elements, it indicates that the inter prediction mode of thecurrent block is a translational motion model-based merge mode. In thiscase, affine_merge_flag, affine_inter_flag, and affine_type_flag may notbe included in the bitstream, and do not need to be obtained by parsingthe bitstream.

For step 802 a to step 804 a, refer to step 602 a to step 604 a. Detailsare not described herein again.

Step 802 b: Construct a motion information candidate list for the affinemotion model-based merge mode.

Specifically, the motion information candidate list for the affinemotion model-based merge mode may be constructed by using a method forpredicting an inherited control point motion vector and/or a constructedcontrol point motion vector.

For constructing the motion information candidate list for the affinemotion model-based merge mode by using the method for predicting theinherited control point motion vector, refer to related descriptions ofD1 in step 602 b. Details are not described herein again.

When candidate control point motion information of the current block isderived by using the method for predicting the constructed control pointmotion vector, and is added to the motion information candidate list,the method specifically includes the following steps:

-   -   (1) Obtain motion information of control points of the current        block. For details, refer to step 601 c. Details are not        described herein again.    -   (2) Combine the motion information of the control points to        obtain constructed control point motion information.

If sps_affine_type_flag=0, motion information of two control points iscombined to construct a 4-parameter affine motion model. The two controlpoints are combined as follows: {CP1, CP4}, {CP2, CP3}, {CP1, CP2},{CP2, CP4}, {CP1, CP3}, or {CP3, CP4}. For example, a 4-parameter affinemotion model constructed by using a 2-tuple that is based on motioninformation (for example, 2 MVs) of control points CP1 and CP2 isdenoted as Affine (CP1, CP2).

If sps_affine_type_flag=1, motion information of three control points iscombined to construct a 6-parameter affine motion model. The threecontrol points are combined as follows: {CP1, CP2, CP4}, {CP1, CP2,CP3}, {CP2, CP3, CP4}, or {CP1, CP3, CP4}. For example, a 6-parameteraffine motion model constructed by using a 3-tuple that is based onmotion information (for example, 3 MVs) of control points CP1, CP2, andCP3 is denoted as Affine (CP1, CP2, CP3). For example, ifsps_affine_type_flag=1, in addition to combining the motion informationof the three control points to construct a 6-parameter affine motionmodel, motion information of two control points may be further combinedto construct a 4-parameter affine motion model.

It should be noted that a combination of different control points mayalso be converted into control points in a same location. For a specificconversion method, refer to related descriptions in step 502. Detailsare not described herein again.

-   -   (3) Add the constructed control point motion information to the        candidate motion vector list.

If a length of the candidate list is less than a maximum list lengthMaxNumMrgCand at this time, these combinations are traversed in a presetorder, to obtain a valid combination as candidate control point motioninformation. If the candidate motion vector list is empty at this time,the candidate control point motion information is added to the candidatemotion vector list. Otherwise, motion information in the candidatemotion vector list is sequentially traversed, to check whether motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list. If no motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list, the candidatecontrol point motion information is added to the candidate motion vectorlist.

For example, if sps_affine_type_flag is 1, a preset order is as follows:Affine (CP1, CP2, CP3)→Affine (CP1, CP2, CP4)→Affine (CP1, CP3,CP4)→Affine (CP2, CP3, CP4)→Affine (CP1, CP2)→Affine (CP1, CP3)→Affine(CP2, CP3)→Affine (CP1, CP4)→Affine (CP2, CP4)→Affine (CP3, CP4). Thereare a total of 10 combinations. An order of adding the 10 combinationsto the candidate motion vector list is not specifically limited in thisembodiment of this application.

If sps_affine_type_flag is 0, a preset order is as follows: Affine (CP1,CP2)→Affine (CP1, CP3)→Affine (CP2, CP3)→Affine (CP1, CP4)→Affine (CP2,CP4)→Affine (CP3, CP4). There are a total of six combinations. An orderof adding the six combinations to the candidate motion vector list isnot specifically limited in this embodiment of this application.

For step 803 b to step 805 b, refer to step 603 b to step 605 b. Detailsare not described herein again.

Referring to FIG. 9 , a second possible implementation is described.

Step 901: Parse a bitstream to obtain an identifier 2.

The identifier 2 is used to indicate whether a candidate motion modelfor inter prediction of a picture block in a slice including ato-be-processed block includes an affine motion model. In other words,the identifier 2 is used to indicate whether the affine motion model canbe used when motion compensation is performed on the picture blockincluded in the slice including the to-be-processed block.

For example, the identifier 2 may be configured in a slice header of theslice of the bitstream. Based on this, the parsing a bitstream to obtainan identifier 2 may be implemented in the following manner: parsing theslice header of the slice of the bitstream to obtain the identifier 2.

Step 902: When the identifier 2 indicates that the candidate motionmodel for inter prediction of the picture block in the slice includingthe to-be-processed block includes an affine motion model, and theto-be-processed block meets a preset condition for inter predictionusing the affine motion model, parse the bitstream to obtain theidentifier 12.

For related descriptions of the preset condition and the identifier 12,refer to the embodiments corresponding to FIG. 7 and FIG. 8 . Detailsare not described herein again.

For example, when the identifier 2 indicates that the candidate motionmodel for inter prediction of the picture block of the slice includingthe to-be-processed block does not include an affine motion model,parameter information related to the affine motion model does not needto be parsed when inter prediction is performed on the picture block ofthe slice. For example, the bitstream does not need to be parsed toobtain the identifier 12.

For example, when the identifier 2 is a value A1, it indicates that thecandidate motion model for inter prediction of the picture block in theslice including the to-be-processed block includes an affine motionmodel, or when the identifier 2 is a value B1, it indicates that thecandidate motion model for inter prediction of the picture block in theslice including the to-be-processed block includes an affine motionmodel. For example, when the identifier 2 is equal to 1, it indicatesthat the candidate motion model for inter prediction of the pictureblock in the slice including the to-be-processed block includes anaffine motion model, or when the identifier 2 is equal to 0, itindicates that the candidate motion model for inter prediction of thepicture block in the slice including the to-be-processed block does notinclude an affine motion model.

Step 903: Determine, based on the identifier 12, a prediction mode forinter prediction of the to-be-processed block, where the prediction modeincludes an affine motion model-based merge mode, an affine motionmodel-based AMVP mode, and a non-affine motion model-based predictionmode.

For example, the identifier 2 may be represented by a syntax elementslice_affine_enabled_flag. slice_affine_enabled_flag specifies whetheraffine model based motion compensation is enabled for inter prediction.For example, slice_affine_enabled_flag is equal to 0, the syntaxelements shall be constrained such that no affine model based motioncompensation is used for the slice, and affine_merge_flag,affine_inter_flag and affine_type_flag are not presented in pictureblock level syntax of the CVS. slice_affine_enabled_flag is equal to 1,affine model based motion compensation may be used for the slice.(slice_affine_enabled_flag specifies whether affine model based motioncompensation can be used for inter prediction. Ifslice_affine_enabled_flag is equal to 0, the syntax elements shall beconstrained such that no affine model based motion compensation is usedfor the slice, and affine_merge_flag, affine_inter_flag andaffine_type_flag are not presented in cu level syntax of the CVS.Otherwise (slice_affine_enabled_flag is equal to 1), affine model basedmotion compensation may be used in the slice).

In the second possible implementation, in a possible example, anidentifier 23 may be further configured in the bitstream. The identifier23 may be configured in a slice header of a slice of the bitstream. Whenthe identifier 2 obtained by parsing the bitstream indicates that thecandidate motion model for inter prediction of the slice including theto-be-processed block includes the affine motion model, the bitstream isfurther parsed to obtain the identifier 23. When the identifier 23 is afirst value, the affine motion model includes only a 4-parameter affinemodel. When the identifier 23 is a second value, the affine motion modelincludes a 4-parameter affine model and a 6-parameter affine model. Thefirst value is different from the second value. For example, the firstvalue is 1, and the second value is 0; or the first value is 0, and thesecond value is 1.

For example, the identifier 23 may be represented byslice_affine_type_flag. slice_affine_type_flag specifies whether6-parameter affine model based motion compensation is enabled for interprediction. For example, slice_affine_type_flag is equal to 0, thesyntax elements shall be constrained such that no 6-parameter affinemodel based motion compensation is used for the slice, andaffine_type_flag is not presented in picture block level syntax in theCVS. Otherwise (slice_affine_type_flag specifies whether 6-parameteraffine model based motion compensation can be used for inter prediction.If slice_affine_type_flag is equal to 0, the syntax elements shall beconstrained such that no 6-parameter affine model based motioncompensation is used in the slice, and affine_type_flag is not presentedin cu level syntax in the CVS. Otherwise (slice_affine_type_flag isequal to 1), 6-parameter affine model based motion compensation may beused in the slice. When not present, the value of slice_affine_type_flagis inferred to be equal to 0).

For example, for syntax structures for parsing the identifier 2 and theidentifier 23, refer to Table 5.

TABLE 5 slice_segment_header( ) { Descriptor ...  slice_affine_enabled_flag u(1)   if(slice_affine_enabled_flag)    slice_affine_type_flag u(1) ... ... }

For example, for a part of syntax structure for parsing the interprediction mode used for the current picture block, refer to Table 6.

TABLE 6 coding_unit(x0, y0, cb Width, cbHeight) { ... merge_flag[x0][y0] ae(v)   if(merge_flag[x0][y0]) {   if(slice_affine_enable_flag && allowAffineMerge)       affine_merge_flag[x0][y0] ae(v) ...  } else {  ...  if(slice_affine_enable_flag && allowAffineInter){       affine_inter_flag[x0][y0] ae(v)    if(slice_affine_type_flag &&affine_inter_flag[x0][y0])          affine_type_flag[x0][y0] ae(v)    }... } ... }

In the second possible implementation, in a possible example, if theidentifier 2 and the identifier 23 are obtained by parsing thebitstream, when the identifier 12 indicates that affine motionmodel-based merge mode is used for inter prediction of theto-be-processed block, and the identifier 23 is the second value, afirst candidate motion vector list is constructed. The first candidatemotion vector list includes a first element, and the first elementincludes motion information of three control points for constructing the6-parameter affine motion model. For example, the first element includesone or more 3-tuples.

Optionally, the first candidate motion vector list may further include asecond element. The second element includes only motion information oftwo control points for constructing the 4-parameter affine motion model.For example, the second element includes one or more 2-tuples. The firstcandidate motion vector list may further include a third element, andthe third element includes motion information of a non-affine motionmodel.

In another possible example, when the identifier 12 indicates thataffine motion model-based merge mode is used for inter prediction of theto-be-processed block, and the identifier 23 is the first value, asecond candidate motion vector list is constructed. The second candidatemotion vector list includes a second element, and the second elementincludes only motion information of two control points for constructingthe 4-parameter affine motion model. The second candidate motion vectorlist does not include a first element. The second candidate motionvector list may further include a third element, and the third elementincludes motion information of a non-affine motion model. Both the firstcandidate motion vector list and the second candidate motion vector listare candidate motion vector lists for the affine motion model-basedmerge mode.

In the second possible implementation, in a possible example, if theidentifier 2 and the identifier 23 are obtained by parsing thebitstream, when the identifier 12 indicates that the affine motionmodel-based AMVP mode is used for inter prediction of theto-be-processed block, and the identifier 23 is the second value, thebitstream is parsed to obtain an identifier 14. When the identifier 14is a third value, the affine motion model is the 6-parameter affinemotion model, or when the identifier 14 is a fourth value, the affinemotion model is the 4-parameter affine motion model. The third value isdifferent from the fourth value. For example, the third value is 1, andthe fourth value is 0; or the third value is 0, and the fourth value is1.

Optionally, the identifier 14 may be represented by a syntax elementaffine_type_flag. For affine_type_flag, refer to related descriptions inTable 1. Details are not described herein again.

The following uses the syntax structures in Table 5 and Table 6 as anexample to describe in detail the inter prediction procedure performedin the second possible manner, as shown in FIG. 10 .

Step 1001: Parse a bitstream based on syntax structures shown in Table 5and Table 6, to determine an inter prediction mode of a current block.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based AMVP mode, step 1002 a is performed.

That is, if slice_affine_enabled_flag=1, merge_flag=0, andaffine_inter_flag=1 in syntax elements, it indicate that the interprediction mode of the current block is the affine motion model-basedAMVP mode.

For example, if slice_affine_enabled_flag=0, and merge_flag=0 in thesyntax elements, it indicates that the inter prediction mode of thecurrent block is a translational motion model-based AMVP mode. In thiscase, affine_merge_flag, affine_inter_flag, and affine_type_flag may notbe included in the bitstream, and do not need to be obtained by parsingthe bitstream.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based merge (merge) mode, step 702 b isperformed.

That is, slice_affine_enabled_flag=1, merge_flag=1, andaffine_merge_flag=1 in the syntax elements, it indicates that the interprediction mode of the current block is the affine motion model-basedmerge mode.

For example, if slice_affine_enabled_flag=0, and merge_flag=1 in thesyntax elements, it indicates that the inter prediction mode of thecurrent block is a translational motion model-based merge mode. In thiscase, affine_merge_flag, affine_inter_flag, and affine_type_flag may notbe included in the bitstream, and do not need to be obtained by parsingthe bitstream.

For step 1002 a to step 1004 a, refer to step 602 a to step 604 a.Details are not described herein again.

Step 1002 b: Construct a motion information candidate list for theaffine motion model-based merge mode.

Specifically, the motion information candidate list for the affinemotion model-based merge mode may be constructed by using a method forpredicting an inherited control point motion vector and/or a constructedcontrol point motion vector.

For constructing the motion information candidate list for the affinemotion model-based merge mode by using the method for predicting theinherited control point motion vector, refer to related descriptions ofD1 in step 602 b. Details are not described herein again.

When candidate control point motion information of the current block isderived by using the method for predicting the constructed control pointmotion vector, and is added to the motion information candidate list,the method specifically includes the following steps:

-   -   (1) Obtain motion information of control points of the current        block. For details, refer to step 601 c. Details are not        described herein again.    -   (2) Combine the motion information of the control points to        obtain constructed control point motion information.

If slice_affine_type_flag=0, motion information of two control points iscombined to construct a 4-parameter affine motion model. The two controlpoints are combined as follows: {CP1, CP4}, {CP2, CP3}, {CP1, CP2},{CP2, CP4}, {CP1, CP3}, or {CP3, CP4}. For example, a 4-parameter affinemotion model constructed by using control points CP1 and CP2 is denotedas Affine (CP1, CP2).

If slice_affine_type_flag=1, motion information of three control pointsis combined to construct a 6-parameter affine motion model. The threecontrol points are combined as follows: {CP1, CP2, CP4}, {CP1, CP2,CP3}, {CP2, CP3, CP4}, or {CP1, CP3, CP4}. For example, a 6-parameteraffine motion model constructed by using control points CP1, CP2, andCP3 is denoted as Affine (CP1, CP2, CP3). For example, ifslice_affine_type_flag=1, in addition to combining the motioninformation of the three control points to construct the 6-parameteraffine motion model, motion information of two control points may befurther combined to construct a 4-parameter affine motion model.

It should be noted that a combination of different control points mayalso be converted into control points in a same location. For a specificconversion method, refer to related descriptions in step 502. Detailsare not described herein again.

-   -   (3) Add the constructed control point motion information to the        candidate motion vector list.

If a length of the candidate list is less than a maximum list lengthMaxNumMrgCand at this time, these combinations are traversed in a presetorder, to obtain a valid combination as candidate control point motioninformation. If the candidate motion vector list is empty at this time,the candidate control point motion information is added to the candidatemotion vector list. Otherwise, motion information in the candidatemotion vector list is sequentially traversed, to check whether motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list. If no motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list, the candidatecontrol point motion information is added to the candidate motion vectorlist.

For example, if slice_affine_type_flag is 1, a preset order is asfollows: Affine (CP1, CP2, CP3)→Affine (CP1, CP2, CP4)→Affine (CP1, CP3,CP4)→Affine (CP2, CP3, CP4)→Affine (CP1, CP2)→Affine (CP1, CP3)→Affine(CP2, CP3)→Affine (CP1, CP4)→Affine (CP2, CP4)→Affine (CP3, CP4). Thereare a total of 10 combinations. An order of adding the 10 combinationsto the candidate motion vector list is not specifically limited in thisembodiment of this application.

If slice_affine_type_flag is 0, a preset order is as follows: Affine(CP1, CP2)→Affine (CP1, CP3)→Affine (CP2, CP3)→Affine (CP1, CP4)→Affine(CP2, CP4)→Affine (CP3, CP4). There are a total of six combinations. Anorder of adding the six combinations to the candidate motion vector listis not specifically limited in this embodiment of this application.

For step 1003 b, refer to step 603 b. Details are not described hereinagain.

For step 1004 b, refer to step 604 b. Details are not described hereinagain.

Referring to FIG. 11 , a third possible implementation is described.

Step 1101: Parse a bitstream to obtain an identifier 1.

Step 1102: When the identifier 1 indicates that a candidate motion modelfor inter prediction of a picture block in a video picture including ato-be-processed block includes an affine motion model, parse thebitstream to obtain an identifier 2.

For example, the identifier 1 may be represented by a syntax elementsps_affine_enabled_flag. sps_affine_enabled_flag specifies whetheraffine model based motion compensation is enabled for inter prediction.For example, if sps_affine_enabled_flag is equal to 0, it indicates thatno affine model based motion compensation is used for the CVS, andslice_affine_enabled_flag are not presented in slice level syntax of theCVS. (sps_affine_enabled_flag equals to 1 specifies thatslice_affine_enabled_flag is present in the slice headers.sps_affine_enabled_flag equal to 0 specifies thatslice_affine_enabled_flag is not present in the slice headers and affinemodel based motion compensation is not used in the CVS).

In a possible example, if the identifier 1 indicates that the candidatemotion model for inter prediction of the picture block in the videopicture including the to-be-processed block includes an affine motionmodel, it indicates that the bitstream includes the identifier 2. If theidentifier 1 indicates that the candidate motion model for interprediction of the picture block in the video picture including theto-be-processed block does not include an affine motion model, itindicates that the bitstream does not include the identifier 2.

Step 1103: When the identifier 2 indicates that a candidate motion modelfor inter prediction of a picture block in a slice including theto-be-processed block includes an affine motion model, and theto-be-processed block meets a preset condition for inter predictionusing the affine motion model, parse the bitstream to obtain anidentifier 12.

For related descriptions of the preset condition, the identifier 1, theidentifier 2, and the identifier 12, refer to the embodimentscorresponding to FIG. 9 and FIG. 10 . Details are not described hereinagain.

Step 1104: Determine, based on the identifier 12, a prediction mode forinter prediction of the to-be-processed block, where the prediction modeincludes an affine motion model-based merge mode, an affine motionmodel-based AMVP mode, and a non-affine motion model-based mode.

In the third possible implementation, in a possible example, anidentifier 23 may be further configured in the bitstream. The identifier23 may be configured in a slice header of a slice of the bitstream. Whenthe identifier 2 obtained by parsing the bitstream indicates that thecandidate motion model for inter prediction of the picture block in theslice including the to-be-processed block includes the affine motionmodel, the bitstream is parsed to obtain the identifier 23. When theidentifier 23 is a first value, the affine motion model includes only a4-parameter affine model. When the identifier 23 is a second value, theaffine motion model includes a 4-parameter affine model and a6-parameter affine model. The first value is different from the secondvalue. For example, the first value is 1, and the second value is 0; orthe first value is 0, and the second value is 1.

For example, for syntax structures for parsing the identifier 1, referto Table 7.

TABLE 7 seq_parameter_set_rbsp( ) { Descriptor ...  sps_affine_enabled_flag u(1) ... ... }

For example, for syntax structures for parsing the identifier 2 and theidentifier 23, refer to Table 8. Details are not described herein again.

TABLE 8 slice_segment_header( ) { Descriptor ...  if(sps_affine_enabled_flag)     slice_affine_enabled_flag u(1)  if(slice_affine_enabled_flag)     slice_affine_type_flag u(1) ... }

For example, for a part of syntax structure for parsing an interprediction mode used for the current picture block, refer to Table 6.

In the inter prediction procedure in the third possible manner, only aprocedure of parsing the bitstream to determine the inter predictionmode of the current block is different from that of the second possiblemanner, and other procedures are the same. Details are not describedherein again.

When the bitstream is parsed to determine the inter prediction mode ofthe current block, if sps_affine_enabled_flag=1,slice_affine_enabled_flag=1, merge_flag=0, and affine_inter_flag=1 insyntax elements, it indicates that the inter prediction mode of thecurrent block is an affine motion model-based AMVP mode.

For example, if sps_affine_enabled_flag=0, and merge_flag=0 in thesyntax elements, it indicates that the inter prediction mode of thecurrent block is a translational motion model based AMVP mode. In thiscase, affine_merge_flag, affine_inter_flag, and affine_type_flag may notbe included in the bitstream, and do not need to be obtained by parsingthe bitstream.

For example, if sps_affine_enabled_flag=1, slice_affine_enabled_flag=0,and merge_flag=0 in the syntax elements, it indicates that the interprediction mode of the current block is a translational motionmodel-based AMVP mode. In this case, affine_merge_flag,affine_inter_flag, and affine_type_flag may not be included in thebitstream, and do not need to be obtained by parsing the bitstream.

If sps_affine_enabled_flag=1, slice_affine_enabled_flag=1, merge_flag=1,and affine_merge_flag=1 in the syntax elements, it indicates that theinter prediction mode of the current block is an affine motionmodel-based merge mode.

For example, if sps_affine_enabled_flag=0, and merge_flag=1 in thesyntax elements, it indicates that the inter prediction mode of thecurrent block is a translational motion model based merge mode. In thiscase, affine_merge_flag, affine_inter_flag, and affine_type_flag may notbe included in the bitstream, and do not need to be obtained by parsingthe bitstream.

For example, if sps_affine_enabled_flag=1, slice_affine_enabled_flag=0,and merge_flag=1, it indicates that the inter prediction mode of thecurrent block is a translational motion model-based merge mode. In thiscase, affine_merge_flag, affine_inter_flag, and affine_type_flag may notbe included in the bitstream, and do not need to be obtained by parsingthe bitstream.

In the third possible implementation, an identifier 13 may be furtherconfigured in the bitstream based on the identifier 1. In the thirdpossible implementation, when the identifier 13 indicates that affinemotion model-based merge mode is used for inter prediction of theto-be-processed block, the identifier 13 may further indicate whetherthe bitstream includes the identifier 23.

After the parsing a bitstream to obtain an identifier 1 in step 1101 andbefore the parsing the bitstream to obtain an identifier 2 in step 1102,the method further includes: parsing the bitstream to obtain anidentifier 13.

The identifier 13 may be represented by a syntax elementsps_affine_type_flag. sps_affine_type_flag is used to indicate whether6-parameter affine motion model-based motion compensation is enabled forinter prediction and whether the bitstream includesslice_affine_type_flag. For example, sps_affine_type_flag=0, itindicates that 6-parameter affine motion model-based motion compensationis not enabled for inter prediction. In this case, a CVS does notinclude a syntax element used to indicate 6-parameter affine motionmodel-based motion compensation. For example, slice_affine_type_flag oraffine_type_flag are not presented in picture block level syntax of theCVS. (slice_affine_type_flag specifies whether 6-parameter affine modelbased motion compensation can be used for inter prediction. Ifslice_affine_type_flag is equal to the syntax elements shall beconstrained such that no 6-parameter affine model based motioncompensation is used in decoding of the current picture, andaffine_type_flag is not presented in cu level syntax of the currentpicture. Otherwise (slice_affine_type_flag is equal to 1), 6-parameteraffine model based motion compensation may be used in decoding of thecurrent picture. When not present, the value of slice_affine_type_flagis inferred to be equal to 0).

For example, for syntax structures for parsing the identifier 1 and theidentifier 13, refer to Table 9.

TABLE 9 seq_parameter_set_rbsp( ) { Descriptor ...  sps_affine_enabled_flag u(1)   if(sps_affine_enabled_flag)    sps_affine_type_flag u(1) ... }

For example, for syntax structures for parsing the identifier 2 and theidentifier 23, refer to Table 10.

slice_segment_header( ) { Descriptor ...   if(sps_affine_enabled_flag)    slice_affine_enabled_flag u(1)   if(sps_affine_type_flag &&slice_affine_enabled_flag)     slice_affine_type_flag u(1) ... }

Based on a same inventive concept as the method embodiment, anembodiment of this application further provides an apparatus. Referringto FIG. 12 , the apparatus 1200 may be specifically a processor, a chip,or a chip system in a video decoder, or a module in a video decoder, forexample, a motion compensation module 322.

For example, the apparatus may include a parsing unit 1201 and aconstruction unit 1202. The parsing unit 1201 and the construction unit1202 perform the steps in the methods shown in the embodimentscorresponding to FIG. 7 to FIG. 11 . For example, the parsing unit 1201may be configured to parse identifiers (for example, an identifier 1, anidentifier 12, an identifier 13, an identifier 14, an identifier 2, andan identifier 23) included in a bitstream, and the construction unit1202 is configured to construct a candidate motion vector list (a firstcandidate motion vector list, a second candidate motion vector list, orthe like).

An embodiment of this application further provides another structure ofa decoding apparatus. As shown in FIG. 13 , the apparatus 1300 mayinclude a communications interface 1310 and a processor 1320.Optionally, the apparatus 1300 may further include a memory 1330. Thememory 1330 may be disposed inside or outside the apparatus. Both theparsing unit 1201 and the construction unit 1202 shown in FIG. 12 may beimplemented by the processor 1320. The processor 1320 sends or receivesa video stream or a bitstream through the communications interface 1310,and is configured to implement the methods in FIG. 7 to FIG. 11 . In animplementation process, steps in a processing procedure may beimplemented by using an integrated logic circuit of hardware in theprocessor 1320 or an instruction in a form of software, to complete themethods in FIG. 7 to FIG. 11 .

The communications interface 1310 in this embodiment of this applicationmay be a circuit, a bus, a transceiver, or any other apparatus that maybe configured to exchange information. For example, the other apparatusmay be a device connected to the apparatus 1300. For example, when theapparatus is a video encoder, the other apparatus may be a videodecoder.

In this embodiment of this application, the processor 1320 may be ageneral-purpose processor, a digital signal processor, anapplication-specific integrated circuit, a field programmable gate arrayor another programmable logic device, a discrete gate or transistorlogic device, or a discrete hardware component, and can implement orperform the methods, steps, and logical block diagrams disclosed in theembodiments of this application. The general-purpose processor may be amicroprocessor or any conventional processor or the like. The steps inthe methods disclosed with reference to the embodiments of thisapplication may be directly performed by a hardware processor, or may beperformed by using a combination of hardware in the processor and asoftware unit. Program code executed by the processor 1320 to implementthe foregoing methods may be stored in the memory 1330. The memory 1330is coupled to the processor 1320.

Coupling in this embodiment of this application is an indirect couplingor a communication connection between apparatuses, units, or modules,may be in an electrical form, a mechanical form, or another form, and isused for information exchange between the apparatuses, the units, or themodules.

The processor 1320 may operate in collaboration with the memory 1330.The memory 1330 may be a nonvolatile memory, for example, a hard diskdrive (hard disk drive, HDD) or a solid-state drive (solid-state drive,SSD), or may be a volatile memory (volatile memory), for example, arandom access memory (random-access memory, RAM). The memory 1330 is anyother medium that can be configured to carry or store expected programcode in a form of an instruction or a data structure and that can beaccessed by a computer, but is not limited thereto.

In this embodiment of this application, a specific connection mediumbetween the communications interface 1310, the processor 1320, and thememory 1330 is not limited. In this embodiment of this application, thememory 1330, the processor 1320, and the communications interface 1310are connected through a bus in FIG. 13 , and the bus is represented by athick line in FIG. 13 . A connection mode between other components ismerely schematically described, and is not limited thereto. The bus maybe classified into an address bus, a data bus, a control bus, and thelike. For ease of representation, only one thick line is used torepresent the bus in FIG. 13 , but this does not mean that there is onlyone bus or only one type of bus.

The foregoing feasible implementations and specific embodiments relatedto FIG. 7 to FIG. 11 describe one or more video data decodingapparatuses in this application. It should be understood that, accordingto the foregoing description, an encoder side usually determines aninter prediction mode and encodes the inter prediction mode into abitstream. After the finally selected inter prediction mode is selected,indicators (for example, the identifier 1, the identifier 2, theidentifier 12, the identifier 13, the identifier 14, and the identifier23 in the foregoing description) of the inter prediction mode areencoded into the bitstream according to an encoding process that iscompletely inverse to that of the foregoing decoding method (whichcorrespond to the identifier 1, the identifier 2, the identifier 12, theidentifier 13, the identifier 14, and the identifier 23 respectivelyparsed in a decoding process). It should be understood that constructionof the candidate motion vector list on the encoder side is completelyconsistent with that on a decoder side. A specific embodiment of theencoder side is not described again. However, it should be understoodthat the video picture prediction method described in this applicationis also applicable to an encoding apparatus.

An embodiment of this application further provides an encodingapparatus. As shown in FIG. 14 , the apparatus 1400 may include acommunications interface 1410 and a processor 1420. Optionally, theapparatus 1400 may further include a memory 1430. The memory 1430 may bedisposed inside or outside the apparatus. The processor 1420 sends orreceives a video stream or a bitstream through the communicationsinterface 1410.

In an aspect, the processor 1420 is configured to: encode an identifier1 into a bitstream; and when the identifier 1 indicates that a candidatemotion model for inter prediction of a picture block in a video pictureincluding a to-be-processed block includes an affine motion model, andthe to-be-processed block meets a preset condition for inter predictionusing the affine motion model, encode an identifier 12 into thebitstream. The identifier 12 is used to determine a prediction mode forinter prediction of the to-be-processed block. The prediction modeincludes an affine motion model-based merge mode, an affine motionmodel-based advanced motion vector prediction (AMVP) mode, and anon-affine motion model-based prediction mode.

In another aspect, the processor 1420 is configured to: encode anidentifier 3 into a bitstream; and when the identifier 3 indicates thata candidate motion model for inter prediction of a picture block in aslice including a to-be-processed block includes an affine motion model,and the to-be-processed block meets a preset condition for interprediction using the affine motion model, encode an identifier 32 intothe bitstream. The identifier 32 is used to determine a prediction modefor inter prediction of the to-be-processed block. The prediction modeincludes an affine motion model-based merge mode, an affine motionmodel-based advanced motion vector prediction (AMVP) mode, and anon-affine motion model-based prediction mode.

The communications interface 1410 in this embodiment of this applicationmay be a circuit, a bus, a transceiver, or any other apparatus that maybe configured to exchange information. For example, the other apparatusmay be a device connected to the apparatus 1400. For example, when theapparatus is a video encoder, the other apparatus may be a videodecoder.

In this embodiment of this application, the processor 1420 may be ageneral-purpose processor, a digital signal processor, anapplication-specific integrated circuit, a field programmable gate arrayor another programmable logic device, a discrete gate or transistorlogic device, or a discrete hardware component, and can implement orperform the methods, steps, and logical block diagrams disclosed in theembodiments of this application. The general-purpose processor may be amicroprocessor or any conventional processor or the like. The steps inthe methods disclosed with reference to the embodiments of thisapplication may be directly performed by a hardware processor, or may beperformed by using a combination of hardware in the processor and asoftware unit. Program code executed by the processor 1420 to implementthe foregoing methods may be stored in the memory 1430. The memory 1430is coupled to the processor 1420.

Coupling in this embodiment of this application is an indirect couplingor a communication connection between apparatuses, units, or modules,may be in an electrical form, a mechanical form, or another form, and isused for information exchange between the apparatuses, the units, or themodules.

The processor 1420 may operate in collaboration with the memory 1430.The memory 1430 may be a nonvolatile memory, for example, a hard diskdrive (hard disk drive, HDD) or a solid-state drive (solid-state drive,SSD), or may be a volatile memory (volatile memory), for example, arandom access memory (random-access memory, RAM). The memory 1430 is anyother medium that can be configured to carry or store expected programcode in a form of an instruction or a data structure and that can beaccessed by a computer, but is not limited thereto.

In this embodiment of this application, a specific connection mediumbetween the communications interface 1410, the processor 1420, and thememory 1430 is not limited. In this embodiment of this application, thememory 1430, the processor 1420, and the communications interface 1410are connected through a bus in FIG. 14 , and the bus is represented by athick line in FIG. 14 . A connection mode between other components ismerely schematically described, and is not limited thereto. The bus maybe classified into an address bus, a data bus, a control bus, and thelike. For ease of representation, only one thick line is used torepresent the bus in FIG. 14 , but this does not mean that there is onlyone bus or only one type of bus.

Based on the foregoing embodiments, an embodiment of this applicationfurther provides a computer storage medium. The storage medium stores asoftware program; and when the software program is read and executed byone or more processors, the method provided in any one or more of theforegoing embodiments may be implemented. The computer storage mediummay include any medium that can store program code, such as a USB flashdrive, a removable hard disk, a read-only memory, a random accessmemory, a magnetic disk, or an optical disc.

Based on the foregoing embodiments, an embodiment of this applicationfurther provides a chip. The chip includes a processor, configured toimplement the functions in any one or more of the foregoing embodiments,for example, obtaining or processing the information or the message inthe foregoing methods. Optionally, the chip further includes a memory,and the memory is configured to store a program instruction and datathat are necessary and executed by the processor. The chip may include achip, or may include a chip and another discrete device.

Although specific aspects of this application have been described withreference to the video encoder 20 and the video decoder 30, it should beunderstood that the technologies of this invention may be applied byusing many other video encoding and/or decoding units, processors,processing units such as a hardware-based decoding unit of anencoder/decoder (CODEC) and a similar unit, and the like. In addition,it should be understood that the steps shown and described in FIG. 6A toFIG. 11 are merely provided as feasible implementations. In other words,the steps shown in the feasible implementations in FIG. 6A to FIG. 11are not necessarily performed in the order shown in FIG. 6A to FIG. 11 ,and fewer, additional, or alternative steps may be performed.

Further, it should be understood that depending on the feasibleimplementations, specific actions or events in any of the methodsdescribed in this specification may be performed in different orders, anaction or event may be added, or the actions or events may be combined,or omitted (for example, not all of the described actions or events arenecessary for implementing the method). Further, in a specific feasibleimplementation, the actions or events may (for example) undergomulti-threading processing or interrupt processing, or may be processedby a plurality of processors simultaneously instead of sequentially.Further, although a specific aspect of this application is described asbeing performed by a single module or unit for purposes of clarity, itshould be understood that the technologies of this application may beperformed by a combination of units or modules associated with a videodecoder.

In one or more feasible implementations, the described functions may beimplemented by using hardware, software, firmware, or any combinationthereof. If the functions are implemented by using software, thefunctions may be stored in a computer-readable medium as one or moreinstructions or code or be transmitted through a computer-readablemedium, and be performed by a hardware-based processing unit. Thecomputer-readable medium may include a computer-readable storage mediumor a communications medium. The computer-readable storage mediumcorresponds to a tangible medium such as a data storage medium. Thecommunications medium includes any medium that facilitates transmissionof a computer program (for example) from one location to anotherlocation according to a communications protocol.

In this manner, the computer-readable medium may correspond to, forexample, (1) a non-transitory tangible computer-readable storage medium,or (2) a communications medium such as a signal or a carrier. The datastorage medium may be any available medium that can be accessed by oneor more computers or one or more processors to retrieve instructions,code, and/or data structures for implementing the technologies describedin this application. A computer program product may include acomputer-readable medium.

By way of a feasible implementation rather than a limitation, thecomputer-readable storage medium may include a RAM, a ROM, an EEPROM, aCD-ROM or another optical disk storage apparatus, a magnetic diskstorage apparatus or another magnetic storage apparatus, a flash memory,or any other medium that can be used to store required code in a form ofan instruction or a data structure and that can be accessed by acomputer. Likewise, any connection may be appropriately referred to as acomputer-readable medium. For example, if an instruction is transmittedfrom a website, server, or another remote source through a coaxialcable, a fiber-optic cable, a twisted pair, a digital subscriber line(DSL), or wireless technologies such as infrared, radio, and microwave,the coaxial cable, fiber-optic cable, twisted pair, DSL, or wirelesstechnologies such as infrared, radio, and microwave are included in adefinition of medium.

However, it should be understood that the computer-readable storagemedium and the data storage medium do not include a connection, acarrier, a signal, or another transitory medium, but alternatively meannon-transitory tangible storage media. A magnetic disk and an opticaldisc used in this specification include a compact disc (CD), a laserdisc, an optical disc, a digital versatile disc (DVD), a floppy disk,and a Blu-ray disc. The magnetic disk usually reproduces datamagnetically, and the optical disc reproduces data optically through alaser. A combination of the foregoing magnetic disk and optical discshall also be included in a scope of the computer-readable medium.

An instruction may be executed by one or more processors such as one ormore digital signal processors (DSP), general-purpose microprocessors,application-specific integrated circuits (ASIC), field programmable gatearrays (FPGA), or other equivalent integrated or discrete logiccircuits. Therefore, the term “processor” used in this specification maybe any one of the foregoing structures or another structure that is usedto implement the technologies described in this specification. Inaddition, in some aspects, the functionality described in thisspecification may be provided in a dedicated hardware and/or softwaremodule configured for encoding and decoding, or may be incorporated intoa combined codec. In addition, the technologies may all be implementedin one or more circuits or logic elements.

The technologies in this application may be implemented in variousapparatuses or devices, including a wireless mobile phone, an integratedcircuit (IC), or a set of ICs (for example, a chip set). Variouscomponents, modules, or units are described in this application toemphasize functional aspects of an apparatus configured to perform thedisclosed technologies, but are not necessarily implemented by differenthardware units. More specifically, as described above, the units may becombined in a codec hardware unit or provided by a set of interoperablehardware units (including one or more processors as described above) inconjunction with suitable software and/or firmware.

The foregoing descriptions are merely examples of specificimplementations of this application, but are not intended to limit theprotection scope of this application. Any variation or replacementreadily figured out by a person skilled in the art within the technicalscope disclosed in this application shall fall within the protectionscope of this application. Therefore, the protection scope of thisapplication shall be subject to the protection scope of the claims.

1. A method for transmitting an encoded bitstream of video data,comprising: receiving the encoded bitstream of video data, the encodedbitstream comprises a plurality of syntax elements, wherein theplurality of syntax elements comprise a first identifier which indicatesthat an affine motion model based motion compensation is enabled for avideo sequence including a picture block to be processed; wherein theencoded bitstream further comprises a second identifier when the firstidentifier indicates that the affine motion model based motioncompensation is enabled for the video sequence and the picture blocksatisfies a condition for inter prediction using the affine motionmodel, and wherein the second identifier indicates that an affine motionmodel based advanced motion vector prediction (AMVP) mode is used forinter prediction of the picture block; wherein the encoded bitstreamfurther comprises a third identifier when the first identifier indicatesthat the affine motion model based motion compensation is enabled forthe video sequence; wherein the encoded bitstream further comprises afourth identifier when the second identifier indicates that the affinemotion model based AMVP mode is used for inter prediction of the pictureblock and the third identifier is a true value; wherein a false value ofthe third identifier indicates that a 6-parameter affine motion modelbased motion compensation is disabled for the video sequence and thetrue value of the third identifier indicates that the 6-parameter affinemotion model based motion compensation is enabled for the videosequence, wherein a true value of the fourth identifier indicates thatthe 6-parameter affine motion model based motion compensation is usedfor inter prediction of the picture block, and wherein the false valueof the fourth identifier indicates that a 4-parameter affine motionmodel based motion compensation is used for inter prediction of thepicture block; and sending the encoded bitstream.
 2. The method of claim1, further comprising: storing the encoded bitstream.
 3. The methodaccording to claim 1, wherein the first identifier is represented bysps_affine_enabled_flag indicating whether the affine motion model basedmotion compensation is enabled for the video sequence, and wherein theaffine motion model based motion compensation is indicated as enabledfor the video sequence when a value of the sps_affine_enabled_flag is 1.4. The method according to claim 1, wherein the third identifier isrepresented by a sequence parameter set (SPS) level flag indicatingwhether the 6-parameter affine motion model based motion compensation isenabled for the video sequence, wherein the SPS level flag has a valueof 1 or 0, wherein the value of 1 of the SPS level flag indicates thatthe 6-parameter affine motion model based motion compensation is enabledfor the video sequence, and wherein the value of 0 of the SPS level flagindicates the 6-parameter affine motion model based motion compensationis disabled.
 5. The method according to claim 1, wherein the secondidentifier is represented by affine_inter_flag indicating whether theaffine motion model-based AMVP mode is used for the picture block when aslice comprising the picture block is a P slice or a B slice, whereinthe affine_inter_flag has a value of 1 or 0, wherein the value of 1 ofthe affine_inter_flag indicates that the affine motion model-based AMVPmode is used for the picture block, and wherein the value of 0 of theaffine_inter_flag indicates that the affine motion model-based AMVP modeis not used for the picture block.
 6. The method according to claim 1,wherein the fourth identifier is represented by affine_type_flag in acoding unit syntax, wherein the affine_type_flag has a value of 1 or 0,indicating whether a 6-parameter affine motion model-based motioncompensation is used for inter prediction of the picture block, whereinthe value of 1 of the affine_type_flag indicates that the 6-parameteraffine motion model-based motion compensation is used for interprediction of the picture block, and wherein the value of 0 of theaffine_type_flag indicates that the 4-parameter affine motionmodel-based motion compensation is used for inter prediction of thepicture block.
 7. The method according to claim 1, wherein the conditioncomprises that a width of the picture block is greater than or equal to16, and a height of the picture block is greater than or equal to
 16. 8.The method according to claim 1, wherein the true value is indicated by1 and the false value is indicated by
 0. 9. A video data encoding devicefor transmitting an encoded bitstream of video data, comprising: anon-transitory memory storage, configured to store video data in a formof a bitstream; and a video encoder, configured to: receive the encodedbitstream for video signals, the encoded bitstream comprises a pluralityof syntax elements, wherein the plurality of syntax elements comprise afirst identifier which indicates that an affine motion model basedmotion compensation is enabled for a video sequence including a pictureblock to be processed; wherein the encoded bitstream further comprises asecond identifier when the first identifier indicates that the affinemotion model based motion compensation is enabled for the video sequenceand the picture block satisfies a condition for inter prediction usingthe affine motion model, and wherein the second identifier indicatesthat an affine motion model based advanced motion vector prediction(AMVP) mode is used for inter prediction of the picture block; whereinthe encoded bitstream further comprises a third identifier when thefirst identifier indicates that the affine motion model based motioncompensation is enabled for the video sequence; wherein the encodedbitstream further comprises a fourth identifier when the secondidentifier indicates that the affine motion model based AMVP mode isused for inter prediction of the picture block and the third identifieris a true value; wherein a false value of the third identifier indicatesthat a 6-parameter affine motion model based motion compensation isdisabled for the video sequence and the true value of the thirdidentifier indicates that the 6-parameter affine motion model basedmotion compensation is enabled for the video sequence, wherein a truevalue of the fourth identifier indicates that the 6-parameter affinemotion model based motion compensation is used for inter prediction ofthe picture block, and wherein the false value of the fourth identifierindicates that a 4-parameter affine motion model based motioncompensation is used for inter prediction of the picture block; and sendthe encoded bitstream.
 10. The device of claim 9, wherein the videoencoder is further configured to store the encoded bitstream.
 11. Thedevice according to claim 9, wherein the first identifier is representedby sps_affine_enabled_flag indicating whether the affine motion modelbased motion compensation is enabled for the video sequence, and whereinthe affine motion model based motion compensation is indicated asenabled for the video sequence when a value of thesps_affine_enabled_flag is
 1. 12. The device according to claim 9,wherein the third identifier is represented by a sequence parameter set(SPS) level flag indicating whether the 6-parameter affine motion modelbased motion compensation is enabled for the video sequence, wherein theSPS level flag has a value of 1 or 0, wherein the value of 1 of the SPSlevel flag indicates that the 6-parameter affine motion model basedmotion compensation is enabled for the video sequence, and wherein thevalue of 0 of the SPS level flag indicates the 6-parameter affine motionmodel based motion compensation is disabled.
 13. The device according toclaim 9, wherein the second identifier is represented byaffine_inter_flag indicating whether the affine motion model-based AMVPmode is used for the picture block when a slice comprising the pictureblock is a P slice or a B slice, wherein the affine_inter_flag has avalue of 1 or 0, wherein the value of 1 of the affine_inter_flagindicates that the affine motion model-based AMVP mode is used for thepicture block, and wherein the value of 0 of the affine_inter_flagindicates that the affine motion model-based AMVP mode is not used forthe picture block.
 14. The device according to claim 9, wherein thefourth identifier is represented by affine_type_flag in a coding unitsyntax, wherein the affine_type_flag has a value of 1 or 0, indicatingwhether a 6-parameter affine motion model-based motion compensation isused for inter prediction of the picture block, wherein the value of 1of the affine_type_flag indicates that the 6-parameter affine motionmodel-based motion compensation is used for inter prediction of thepicture block, and wherein the value of 0 of the affine_type_flagindicates that the 4-parameter affine motion model-based motioncompensation is used for inter prediction of the picture block.
 15. Thedevice according to claim 9, wherein the condition comprises that awidth of the picture block is greater than or equal to 16, and a heightof the picture block is greater than or equal to
 16. 16. The deviceaccording to claim 9, wherein the true value is indicated by 1 and thefalse value is indicated by
 0. 17. A non-transitory computer-readablestorage medium storing one or more instructions executable on a computerto perform operations comprising: receiving an encoded bitstream ofvideo data, the encoded bitstream comprises a plurality of syntaxelements, wherein the plurality of syntax elements comprise a firstidentifier which indicates that an affine motion model based motioncompensation is enabled for a video sequence including a picture blockto be processed; wherein the encoded bitstream further comprises asecond identifier when the first identifier indicates that the affinemotion model based motion compensation is enabled for the video sequenceand the picture block satisfies a condition for inter prediction usingthe affine motion model, and wherein the second identifier indicatesthat an affine motion model based advanced motion vector prediction(AMVP) mode is used for inter prediction of the picture block; whereinthe encoded bitstream further comprises a third identifier when thefirst identifier indicates that the affine motion model based motioncompensation is enabled for the video sequence; wherein the encodedbitstream further comprises a fourth identifier when the secondidentifier indicates that the affine motion model based AMVP mode isused for inter prediction of the picture block and the third identifieris a true value; wherein a false value of the third identifier indicatesthat a 6-parameter affine motion model based motion compensation isdisabled for the video sequence and the true value of the thirdidentifier indicates that the 6-parameter affine motion model basedmotion compensation is enabled for the video sequence, wherein a truevalue of the fourth identifier indicates that the 6-parameter affinemotion model based motion compensation is used for inter prediction ofthe picture block, and wherein the false value of the fourth identifierindicates that a 4-parameter affine motion model based motioncompensation is used for inter prediction of the picture block; andsending the encoded bitstream.
 18. The non-transitory computer-readablestorage medium of claim 17, the operations further comprising: storingthe encoded bitstream.
 19. The non-transitory computer-readable storagemedium according to claim 17, wherein the first identifier isrepresented by sps_affine_enabled_flag indicating whether the affinemotion model based motion compensation is enabled for the videosequence, and wherein the affine motion model based motion compensationis indicated as enabled for the video sequence when a value of thesps_affine_enabled_flag is
 1. 20. The non-transitory computer-readablestorage medium according to claim 17, wherein the third identifier isrepresented by a sequence parameter set (SPS) level flag indicatingwhether the 6-parameter affine motion model based motion compensation isenabled for the video sequence, wherein the SPS level flag has a valueof 1 or 0, wherein the value of 1 of the SPS level flag indicates thatthe 6-parameter affine motion model based motion compensation is enabledfor the video sequence, and wherein the value of 0 of the SPS level flagindicates the 6-parameter affine motion model based motion compensationis disabled.